You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
399 B

// 狗类:继承动物抽象类,同时实现游泳接口
public class Dog extends Animal implements Swimmable {
// 重写抽象方法:狗的叫声
@Override
public void makeSound() {
System.out.println("汪汪汪!");
}
// 实现接口方法:狗会游泳
@Override
public void swim() {
System.out.println("狗刨式游泳");
}
}