Java OCA OCP Practice Question 1350

Question

Which statement is true about a non-static inner class?

  • A. It must implement an interface.
  • B. It is accessible from any other class.
  • C. It can only be instantiated in the enclosing class.
  • D. It must be final, if it is declared in a method scope.
  • E. It can access private instance variables in the enclosing object.


E.

Note

An object of a non-static inner class is able to access private variables of objects of the outer class in which it is defined.




PreviousNext

Related