Skip to content
Sharp

Object-oriented programming · interview question

Why might you prefer to use an interface instead of an abstract class in Java?

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

Correct answer

A. To allow a class to implement multiple types

Why

Interfaces allow a class to implement multiple types, providing flexibility in design. This is useful in Java, which does not support multiple inheritance of classes but does allow a class to implement multiple interfaces.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →