public class Main { public static void main(String[] args) { // Test polymorphism with Animal references Animal dog = new Dog(); Animal cat = new Cat(); System.out.println("Testing makeSound():"); dog.makeSound(); // Should output "Woof!" cat.makeSound(); // Should output "Meow!" // Test swim() method for Dog System.out.println("\nTesting swim():"); if (dog instanceof Swimmable) { Swimmable swimmableDog = (Swimmable) dog; swimmableDog.swim(); // Should output "Dog is swimming" } // Test that Cat doesn't implement Swimmable if (!(cat instanceof Swimmable)) { System.out.println("Cat cannot swim"); } } }