0

for example in the code below I want to get "Dog" or "Cat". How do I do that?

public class Animal {
    // insert code here
}

public class Dog extends Animal {
    // insert code here
}

public class Cat extends Animal {
    // insert code here
}

public class test {
    Animal animal = new Animal();
    // how do I get the name of the subclass i.e. how to get that the 
    // animal is a dog if it is in fact a dog??!
}
thelili018
  • 43
  • 1
  • 6

0 Answers0