// Dog类,继承Animal抽象类并实现Swimmable接口 public class Dog extends Animal implements Swimmable { // 重写makeSound方法,实现狗的叫声 @Override public void makeSound() { System.out.println("Dog barks: Woof! Woof!"); } // 实现swim方法,定义狗的游泳行为 @Override public void swim() { System.out.println("Dog is swimming"); } }