abstract class Animal { abstract void makeSound(); } interface Swimmable { void swim(); } class Dog extends Animal implements Swimmable { public void makeSound() { System.out.println("Woof!"); } public void swim() { System.out.println("Dog is swimming!"); } } class Cat extends Animal { public void makeSound() { System.out.println("Meow!"); } } public class Main { public static void main(String[] args) { Animal myDog = new Dog(); Animal myCat = new Cat(); myDog.makeSound(); myCat.makeSound(); if (myDog instanceof Swimmable) { ((Swimmable) myDog).swim(); } } }