Default interface method for abstract superclass

Viewed 1639

Lets say I have the following structure:

abstract class A {
     abstract boolean foo();
}

interface B {
     default boolean foo() { return doBlah(); }
}

class C extends A implements B {
    //function foo
}

Java will now complain that class C must implement abstract method foo from A. I can work around this problem relatively easy by redefining the function in C and simply calling B.super.foo();.

however I do not understand why the default function from interface B does not forfill this requirement on its own, and I would like to have a better understanding of the underlying mechanics of java.

3 Answers
Related