• Dear Guest, Please do NOT forget to join our JAVA JOBS (ONLY) FACEBOOK GROUP to be aware of latest JAVA openings, and you may also post any JAVA related queries/jobs.

Can we access Private members of Super Class ?

No, A SubClass does not inherit the Private Members of its SuperClass.

But indirectly we can, how means see bellow :

- If the SuperClass has public or protected methods for accessing its Private Fields, these we can also use in SubClass.

- A Nested Class has access to all the Private Members (fields and methods) of its enclosing Class. Therefore, a public or protected Nested Class inherited by our SubClass has indirect access to all of the Private members of the SuperClass.
Functionally, its not inherited. Yet ideally, it may be. An subclass doesn't inherit the private parts about its guardian population. However, On those superclass need government funded alternately ensured strategies to gaining entrance to its private fields, these could Additionally make utilized by the subclass.