The inner class is the class defined inside a class, and the inner class can be declared as public, private, protected. If the inner class defined as private and protected, can outer class access the members of inner class? and can inner class access members of outer class?
If the inner class defined as private and protected, can outer class access the members of inner class?
Yes. These qualifiers will only affect the visibility of the inner class in classes that derive from the outer class.
Can inner class access members of outer class?
Yes, including the ones declared private
, just as any instance method can.