interface Eatable {
void eat();
}
public class EatDemo {
public static void main(String[] args) {
Eatable dog = ()->{
System.out.println("小狗爱吃骨头");
};
Eatable cat = ()->{
System.out.println("小猫爱吃鱼");
};
Eatable chick = ()->{
System.out.println("小鸡爱吃毛毛虫");
};
dog.eat();
cat.eat();
chick.eat();
}
}
网友评论