This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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>
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.