Skip to content
Sharp

Object-oriented programming · interview question

Why might a developer choose to use an abstract class instead of an interface in Java?

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

Correct answer

C. To provide shared code among related classes.

Why

A developer might choose an abstract class instead of an interface to provide shared code among related classes, as abstract classes can contain both abstract and concrete methods.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →