cannot call default method of parent interface using super

91 Views Asked by At
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();
    }
}

Can someone please explain why I am not able to call default method of parent interface using super keyword.

0

There are 0 best solutions below