Skip to content
Sharp

Object-oriented programming · interview question

Why does an interface in Java matter in practice?

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

Correct answer

B. To define a contract for classes to implement

Why

The primary purpose of an interface in Java is to define a contract that classes must implement. This allows different classes to provide specific implementations while adhering to the same method signatures.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →