Skip to content
Sharp

Object-oriented programming · interview question

If a class method conflicts with an interface default method of the same signature, which implementation wins?

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

Correct answer

B. The class method wins

Why

One of Java's default-method rules is that class methods take precedence over interface defaults. This keeps class behavior from being unexpectedly replaced by an interface implementation.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →