import java.util.Random;
publicclass JAVA_078
{
publicstaticvoid main(String[] args)
{
Animal[] theAnimals={ new Dog("Rover","Poodle"),
new Cat("Max","Abyssinian"),
new Duck("Daffy","Aylesbury"),
new Spaniel("Fido") };
Animal petChoice;
Random select=new Random( );
for(int i=0;i<5;i++)
{
petChoice=theAnimals[select.nextInt(theAnimals.length)];
System.out.println("\nYour Choice :\n" + petChoice);
petChoice.sound( );
}
}
}