1.

How to refer to method of nested class?(a) enclosingClassObject.innerClassObject.method();(b) innerClassObject.method();(c) method();(d) depends on where the method is being calledThis question was posed to me in an online quiz.This question is from Object Reference topic in portion Object of Object Oriented Programming

Answer»

The correct option is (d) depends on where the method is being called

Explanation: This depends on where the method is being called. If the method is called inside the enclosing class itself. Then we can’t USE OBJECT of enclosing class. If the method is being called WITHIN the inner class itself, then its object will ALSO be of no use.



Discussion

No Comment Found

Related InterviewSolutions