Note that a protected access enables a member to be seen
in other classes of the package
containing the class with the protected member.
Schematically, here is how this can be summarized,
so suppose that we have a protected member
in a class defined in a certain package
then this protected member is directly accessible
in all the classes descendant from A
whether they are in the same package or not
which means that in all the classes derived from A,
this access is possible.
And what if there isn't any dependency?
Well, in Java, a protected member is also accessible
in all the classes in the same package
as the class containing the protected member
even if they are not linked by inheritance.
For example, the class C, doesn't have any relationship
with the class A, but it is in the same package,
hence a method from C
can directly access a protected data member of A
through any instance of A,
without having to use another method.
This access is possible.
On the other hand, a class in another package,
and does not have an inheritance relationship
with the class in which the protected member is
can not access the protected data members.
Here, for example, the class E cannot access
the protected member "a" through an instance of A.