Skip to content
Sharp

Core Java · interview question

Why did Java introduce default methods in interfaces?

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

Correct answer

D. To allow interfaces to provide method implementations without breaking existing code

Why

Default methods were introduced in Java 8 to allow interfaces to provide method implementations without breaking existing implementations. This helps evolve APIs while 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 →