Skip to content
Sharp

Core Java · interview question

Why does an interface in Java matter in this design?

Multiple choiceEasychapter-5-curatedpremiumcore-javaupcasting-and-dynamic-dispatch
Choose one answer
Answer and explanation

Correct answer

C. To provide a blueprint for classes.

Why

Interfaces in Java define a contract that classes must follow, providing a blueprint for the methods that implementing classes need to provide. This ensures that different classes can be used interchangeably if they implement the same interface.

Test yourself on Core Java

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

Start free test
All Core Java questions →