class Animal {
    void speak() {
        System.out.println("동물이 소리를 냅니다.");
    }
}

class Dog extends Animal {
    @Override
    void speak() {
        System.out.println("멍멍");
    }
}

class Cat extends Animal {
    @Override
    void speak() {
        System.out.println("야옹");
    }
}

class Duck extends Animal {
    @Override
    void speak() {
        System.out.println("꽥꽥");
    }
}

class Lion extends Animal {
    @Override
    void speak() {
        System.out.println("어흥");
    }
}

public class Zoo2 {

    public static void main(String[] args) {
        Animal[] animals = new Animal[4];
        animals[0] = new Dog();
        animals[1] = new Cat();
        animals[2] = new Duck();
        animals[3] = new Lion();

        for (Animal a : animals) {
            a.speak();
        }
    }
}