无法使用 super 调用父接口的默认方法

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 关键字调用父接口的默认方法。

chz_zc 回答:无法使用 super 调用父接口的默认方法

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2687.html

大家都在问