title: Java 8 default method inheritance
body: <p>Let's say there are following types:</p>
  
  <pre><code>public interface Base {
  
      default void sayHi(){
          System.out.println("hi from base");
      }
  }
  
  public interface Foo extends Base {
      @Override
      default void sayHi(){
          System.out.println("hi from foo");
      }
  }
  
  public interface Bar extends Base {
  }
  
  public class MyClass implements Foo, Bar {
      public static void main(String[] args) {
          MyClass c = new MyClass();
          c.sayHi();
      }
  }
  </code></pre>
  
  <p>In this scenario, if <code>main</code> is executed, "hi from foo" is printed. Why does <code>Foo</code>'s implementation take precedence? Doesn't <code>Bar</code> inherit <code>sayHi()</code> from <code>Base</code>, since if <code>MyClass</code> was to only implement <code>Bar</code>, the <code>Base</code> implementation would be called? So it would make sense for the code to still not compile. Also, since <code>Bar</code> should have <code>Base</code>'s implementation of <code>sayHi()</code>, why can't I override it in <code>MyClass</code> like:</p>
  
  <pre><code>@Override
  public void sayHi() {
      Bar.super.sayHi();
  }
  </code></pre>
  
  <p>The following error occurs when trying to do so:</p>
  
  <blockquote>
    <p>bad type qualifier Bar in default super call method, sayHi() is overridden in Foo</p>
  </blockquote>