java代码定义一个animal接口,内有shout方法,先返回值类型,再定义三个类,分别实现狗叫声,猫叫声,鸟叫声
interfaceanimal{voidshout();
}
classDogimplementsanimal{
publicvoidshout(){
System.out.println("汪汪叫");
}
}
classCatimplementsanimal{
publicvoidshout(){
System.out.println("喵喵叫");
}
}
classBirdimplementsanimal{
publicvoidshout(){
System.out.println("唧唧叫");
}
}
上一篇:怎么样下裁鸟叫声啊
下一篇:平面毕业设计要做几张
多重随机标签