class Animal {
public String toString() {
return "This is an animal ";
}
}
class Dog extends Animal {
publicvoid sound() {
System.out.println("Woof Woof");
}
}
publicclass MainClass {
publicstaticvoid main(String[] a) {
Dog aDog = new Dog();
if (aDog instanceof Animal) {
Animal ani = (Animal) aDog;
System.out.println(ani);
}
}
}