interface WithDefinitionsInter {
default void definedMeth() {
System.out.println("inside interface");
}
}
class WithDefinitionsImpl implements WithDefinitionsInter {
public void definedMeth() {
super.definedMeth(); // compilation error here
System.out.println("inside class");
}
}
public class QuizDef {
public static void main(String par[]) {
WithDefinitionsInter withDef = new WithDefinitionsImpl();
withDef.definedMeth();
}
}
谁能解释一下为什么我不能使用 super 关键字调用父接口的默认方法。