up you are right...protected members outside the package can only be referenced through the reference variable of the sub-class & outside the package they behave(logically & not technically) as the private member of that sub-class.
"History would be kind to me, for I intend to write it."
Joined: Jun 28, 2007
Just rearranged the code a little !!
I think it should becausse the method say() is protected and SubTwo does not inherit from Subone ... so say() should not be visible in SubTwo ..... please correct me if i am wrong !!
Hi Sree, the answer to your question is yes. Because SubOne is inheriting the protected say() from Super. so now it is private in SubOne. So there is no way to access private members outside the class. "Protected members will become private in subclasses outside of the package". reference: page no: 70,71 K & B. i hope it helps you.