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

Question: 1 / 510

Can you create an object of an inner class without an instance of the outer class?

Yes

No

Only if the inner class is static

An inner class is a class within another class. It can only be accessed through an instance of the outer class. This means that to create an object of an inner class, an instance of the outer class must first be created. Therefore, options A, B, and D are incorrect as they all require an instance of the outer class. The only option that is correct is C, which states that an object of an inner class can be created without an instance of the outer class if the inner class is declared as static. This means that the inner class is not tied to any specific instance of the outer class and can be accessed independently.

Get further explanation with Examzify DeepDiveBeta

Only if the constructor is public

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy