When a class implements two interfaces with the same default method, it must override that method itself, and can pick a specific parent's version with Interface.super.method().
interface A { default String who() { return "A"; } }
interface B { default String who() { return "B"; } }
class C implements A, B {
@Override
public String who() {
return A.super.who() + B.super.who();
}
}
System.out.println(new C().who());
AB
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27