Mastering Java: The Ultimate 2025 All-In-One Quiz to Excel in 'Thinking in Java

Image Description

Question: 1 / 510

How can you access the outer class's reference from an inner class?

Using Outer.this

In Java, when an inner class is accessed from an outer class, it creates a special bond between the two. By using the keyword 'this' in the inner class, the special bond can be accessed in order to obtain the outer class's reference. Options B and C are incorrect as the outer class name cannot be used directly to access its reference and it is indeed possible to access the outer class's reference from an inner class. Option D is incorrect as there is no specific method called getOuter() for accessing the outer class's reference.

Get further explanation with Examzify DeepDiveBeta

Directly by the outer class name

It's not possible

Using a special method getOuter()

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy