default default在接口方法中使用,方法为默认方法,实现此接口的类可以不实现此方法。
interface I1{
default void helloWorld() {
System.out.println("HelloWorld");
}
}
class A implements I1{
}
//调用:
A a = new A();
a.helloWorld();Copyright©2023 字节宝字节宝| |
违法和不良信息举报电话:|举报邮箱:3111859717@qq.com
