Skip to content
Sharp

Core Java · interview question

Why are default methods in interfaces beneficial for API evolution?

Multiple choiceMediumchapter-5-curatedpremiumcore-javadefault-methods-and-multiple-inheritance
Choose one answer
Answer and explanation

Correct answer

D. They allow adding methods to interfaces without breaking existing implementations.

Why

Default methods allow interfaces to evolve by adding new methods without forcing all implementing classes to provide implementations, thus maintaining backward compatibility.

Test yourself on Core Java

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

Start free test
All Core Java questions →