Actually, you can freely choose an existing implementation. Let me give you a slightly more complex scenario than yours. To make things worse, all A , B and C have the same method signature.
interface A { default void doWork() { System.out.println("Default implementation From A"); } } interface B{ default void doWork() { System.out.println("Default implementation From B"); } } class C{ void doWork(){ System.out.println("Default implementation From C"); } }
Now I create a subclass of C that implements A and B:
class Tester extends C implements A, B { @Override public void doWork(){ A.super.doWork();
The output will look like this:
Default implementation From A Default implementation From B Default implementation From C
when you run :
new Tester().doWork();
source share