Skip to content
Sharp

Object-oriented programming · interview question

Why do teams use interfaces in Java in production code?

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

Correct answer

C. To define a contract that other classes can implement

Why

Interfaces in Java are used primarily to define a contract that other classes can implement. They specify methods that must be implemented, thereby ensuring a certain level of functionality.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →