Skip to content
Sharp

Object-oriented programming · interview question

Why might you choose an abstract class over an interface in Java?

Multiple choiceEasychapter-5-curatedpremiumooppolymorphism
Choose one answer
Answer and explanation

Correct answer

B. To provide shared code among related classes

Why

An abstract class is chosen over an interface when you want to provide shared code among related classes. Abstract classes can have concrete methods, constructors, and fields, which allows for code reuse.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →