001package java8; 002 003import com.sandwich.koan.Koan; 004 005import static com.sandwich.koan.constant.KoanConstants.__; 006import static com.sandwich.util.Assert.assertEquals; 007 008public class AboutMultipleInheritance { 009 010 interface Human { 011 default String sound() { 012 return "hello"; 013 } 014 } 015 016 interface Bull { 017 default String sound() { 018 return "moo"; 019 } 020 } 021 022 class Minotaur implements Human, Bull { 023 //both interfaces implement same default method 024 //has to be overridden 025 @Override 026 public String sound() { 027 return Bull.super.sound(); 028 } 029 } 030 031 @Koan 032 public void multipleInheritance() { 033 Minotaur minotaur = new Minotaur(); 034 assertEquals(minotaur.sound(), __); 035 } 036 037}