Section 9.3 protected Members
• A superclass’s public
members are accessible wherever the program has a reference to an object of that superclass or one of its subclasses.
• A superclass’s private
members can be accessed directly only within the superclass’s declaration.
• A superclass’s protected
members (p. 364) have an intermediate level of protection between public
and private
access. They can be accessed by members of the superclass, by members of its subclasses and by members of other classes in the same package.
• A superclass’s private
members are hidden in its subclasses and can be accessed only through the public
or protected
methods inherited from the superclass.
• An overridden superclass method can be accessed from a subclass if ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.