1.

The nested class can be declared ___________________(a) Public(b) Private(c) Protected(d) Public, Protected, Private or Package privateThe question was posed to me by my college director while I was bunking the class.My doubt is from Nested Class topic in chapter Class Members & Types of Object Oriented Programming

Answer»

Correct answer is (d) PUBLIC, PROTECTED, PRIVATE or PACKAGE private

The best I can explain: The nested class can be declared with any specifier, unlike the outer classes which can only be declared public or package private. This is flexibility given for the nested class being a member of enclosing class.



Discussion

No Comment Found

Related InterviewSolutions