posted 17 years ago
protected variable x can be accessed in the same package or subclasses of the class in which they are declared isint it?
yes thats correct.
but my question is ,There is no connection between Amir class and Anand class.Im accessing variable x from New1 instance.not from Amir class instance.
see Anand and New1 are in different packages, and Anand not a subclass of New1 class .But Anand can access the inherited protected variable of New1 class.
How is it Possible.
New1 has access to x and all instantiations of New1 will provide this value i guess....correct me if im wrong...