About Question enthuware.ocajp.i.v8.2.1479 :
Posted: Mon Mar 30, 2015 9:31 am
In fact you can rase this ambiguity by overriding the method with the same signature in the class. This compile and print "in CI.m1".You cannot have a class that implements two interfaces where both the interfaces contain a default method with the same signature.
Code: Select all
class MyTest {
public static final void main(String[] args) {
new CI().m1();
}
}
interface I1 {
public default void m1() {
System.out.println("in I1.m1");
}
}
interface I2 {
public default void m1() {
System.out.println("in I2.m1");
}
}
class CI implements I1, I2 {
public void m1() {
System.out.println("in CI.m1");
}
}