title: Can a default method implementation be used to implement an abstract method in a base class
body: <p>If I have a class with an abstract method:</p>
  
  <pre><code>abstract class Base {
      abstract void foo();
  }
  </code></pre>
  
  <p>and an interface that declares the same method with a default implementation: </p>
  
  <pre><code>interface Inter {
       default void foo() {
           System.out.println("foo!");
       }
  }
  </code></pre>
  
  <p>do I need to provide an implementation in a class that implements/extends both?</p>
  
  <pre><code>class Derived extends Base implements Inter {
  
  }
  </code></pre>
  
  <p>It seems like this should work, but I get a compilation error that <code>Derived</code> is not abstract and does not override the abstract method <code>foo</code>.</p>
  
  <p>I am guessing that the abstract method from the class is "more important" than the default method from the interface.</p>
  
  <p>Is there a good way to make this work?  </p>
  
  <p>My underlying problem is that I have a three level abstract class hierarchy (<code>A</code> and <code>B</code> extend <code>C</code>, <code>D</code> and <code>E</code> extend <code>F</code>, <code>C</code> and <code>F</code> extend <code>G</code>), which will have multiple implementations of the leaf classes.  Within each set of implementations, there are common methods being implemented that are defined in the base classes, so I hoped to write</p>
  
  <pre><code>abstract class C extends G {
       abstract void foo();
       abstract void bar();
       abstract void quz();
       void baz() {
           foo();
           bar();
       }
  }
  
  abstract class A extends C {
      void quz() { /* impl */ }
  }
  abstract class B extends C {
      void quz() { /* different impl */ }
  }
  
  interface C1 {
       default void foo() { /* impl for first set of classes */ }
  }
  class A1 extends A implements C1 {
       @Override void bar() { ... }
       // foo implementation from C1
  }
  class B1 extends B implements C1 {
       @Override void bar() { ... }
  }
  
  interface C2 {
       default void foo() { /* impl for second set of classes */ }
  }
  class A2 extends A implements C2 {
       @Override void bar() { ... }
       // foo implementation from C2
  }
  class B2 extends B implements C2 {
       @Override void bar() { ... }
  }
  </code></pre>