默认方法例子
public interface LiveAble {
public default void fly(){
System.out.println("飞");
}
}
public class Animal implements LiveAble {
// 继承,什么都不用写,直接调用
}
public interface LiveAble {
public default void fly(){
System.out.println("飞");
}
}

posted on 2023-11-07 19:33  杨申龙  阅读(9)  评论(0)    收藏  举报