default default在接口方法中使用,方法为默认方法,实现此接口的类可以不实现此方法。
interface I1{ default void helloWorld() { System.out.println("HelloWorld"); } } class A implements I1{ } //调用: A a = new A(); a.helloWorld();