J.II · Java 25 practice question
A developer creates an interface that extends two superinterfaces, each providing a default method with the same signature, without declaring that method in the subinterface. How does the Java 25 compiler handle this?
Check answer and explanation
Correct answer: It reports a compile-time error because a default method is override-equivalent with another inherited method.
Explanation
The compiler reports a compile-time error whenever an interface inherits a default method that is override-equivalent with another inherited method, whether that other method is default or abstract.
Common trap
The order of superinterfaces in an extends clause never breaks ties between conflicting default methods in Java. Conflict detection happens on the subinterface declaration itself, not later when a class implements it.
Source: JLS SE 25 §9.4.1.3. Inheriting Methods with Override-Equivalent Signatures
Checked against the cited text on 2026-11-25.