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.
16 lines
384 B
16 lines
384 B
package w6;
|
|
|
|
public class Dog extends Animal
|
|
implements Swimmable {
|
|
// 重写Animal的抽象方法makeSound()
|
|
@Override
|
|
public void makeSound() {
|
|
System.out.println("汪汪");
|
|
}
|
|
|
|
// 步骤3实现Swimmable接口后,需重写swim()方法
|
|
@Override
|
|
public void swim() {
|
|
System.out.println("狗会游泳~");
|
|
}
|
|
}
|
|
|