2 changed files with 22 additions and 0 deletions
@ -0,0 +1,9 @@ |
|||||
|
package w6; |
||||
|
|
||||
|
public class Cat extends Animal { |
||||
|
@Override |
||||
|
public void makeSound() { |
||||
|
System.out.println("喵喵喵"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
package w6; |
||||
|
|
||||
|
public class Dog extends Animal implements Swimmable{ |
||||
|
@Override |
||||
|
public void makeSound() { |
||||
|
System.out.println("汪汪汪!"); |
||||
|
|
||||
|
} |
||||
|
@Override |
||||
|
public void swim() { |
||||
|
System.out.println("狗刨式游泳"); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue