We would like to know how to overwrite default method.
// www.j a v a 2s .c o m public class Main { public static void main(String[] args) { HelloInterface hello = new My(); hello.hello(); } } @FunctionalInterface interface SimpleFuncInterface { public void doWork(); } interface HelloInterface { public default void hello() { System.out.println("default hello"); } } class My implements HelloInterface { @Override public void hello() { System.out.println("hello melin"); } }
The code above generates the following result.