Skip to content
Sharp

Object-oriented programming · interview question

How does using interfaces in Java improve testability of code?

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

Correct answer

A. Interfaces allow for easier change of implementation without affecting the test code.

Why

Interfaces improve testability by allowing different implementations to be swapped out easily, enabling tests to focus on the interface contract rather than specific implementations.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →