麻烦帮忙检查一下
来源:5-13 编程练习
慕沐1462760
2020-06-30 10:30:14
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
Balloon balloon=new Balloon();
Bird bird=new Bird();
Plane plane=new Plane();
plane.fly();
bird.fly();
balloon.fly();
}
}
public class Balloon implements IFly{
public void fly() {
System.out.println("气球飞上天空");
}
}
public class Bird implements IFly{
public void fly() {
System.out.println("小鸟在天空翱翔");
}
}
public class Plane implements IFly{
public void fly() {
System.out.println("飞机在天上飞");
}
}
public interface IFly {
public void fly();
}
1回答
同学你好,同学完成的不错哦,继续加油!
如果我的回答解决了你的疑惑,请采纳!祝学习愉快!
相似问题