Skip to content
Sharp

Object-oriented programming · interview question

When is inheritance an honest design choice in Java?

Multiple choiceEasychapter-5-curatedpremiumoopinheritance-basics
Choose one answer
Answer and explanation

Correct answer

D. When the subtype is a real, stable specialized form of the parent type

Why

A strong inheritance hierarchy models a true subtype relationship. If the motivation is only code reuse or convenience, composition or an interface is often the better tool.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →