Mastering Java 2025 – 400 Free Practice Questions to Pass the 'Thinking in Java' Exam

Image Description

Question: 1 / 510

How does an inner class access the members of its enclosing class?

Through a passed-in reference

Directly

An inner class can access the members of its enclosing class directly, without the need for a passed-in reference, reflection, or public getter methods. Option A is incorrect because an inner class does not need to be passed in a reference to access its enclosing class members. Option C is incorrect because reflection involves using Java APIs to manipulate classes and objects at runtime, which is not necessary in this case. Option D is incorrect because getter methods are not required to access members of the enclosing class from an inner class.

Get further explanation with Examzify DeepDiveBeta

Using reflection

With public getter methods

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy