Skip to content
Sharp

Core Java · interview question

Why might you use an abstract class instead of an interface with default methods?

Multiple choiceMediumchapter-5-curatedpremiumcore-javadefault-methods-and-multiple-inheritance
Choose one answer
Answer and explanation

Correct answer

B. To provide a common state shared by subclasses

Why

An abstract class can contain fields and non-static methods with implementations, allowing subclasses to share a common state. This is not possible with interfaces, even with default methods.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →