Multiple choice

Which of the following is true?

i. A nested class has access to the members of its outer class. ii. A nested class will never have access to the members of its outer class. iii. A inner class is a non-static nested class. iv. A inner class is a static nested class.

  1. i. and iii both are correct

  2. i. and iv. both are correct

  3. ii. and iii. both are correct

  4. ii. and iv. both are correct

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This answer is correct. A nested class will have access to the members in the outer class including its private members. Also an inner class is always a non-static class and it has access to all the other non-static members of the outer class.