Write a Java program to create an abstract class Animal with an abstract method called sound(). Create subclasses Lion and Tiger that extend the Animal class and implement the sound() method to make a specific sound for each animal.

Source Code:

abstract class Animal {
abstract void sound();
}

class Lion extends Animal {
void sound() {
System.out.println(“Roar”);
}
}

class Tiger extends Animal {
void sound() {
System.out.println(“Growl”);
}
}

public class TestAbstractAnimal {
public static void main(String[] args) {
Animal l = new Lion();
Animal t = new Tiger();
l.sound();
t.sound();
}
}

Output: