Once the subclass-outside-the package inherits the protected member, that member becomes private to any code outside the class.
I am confused this point. Could any one explain me with one example?
Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
posted 10 years ago
I think it's something like this -
Compiling this gives an error because the class ProtTest cannot access baseVar as pc.baseVar. baseVar is inherited by ProtChild, but outside of the class it is not visible. If you change the println as System.out.println( pc.method() ); then, there will be no error.