I have three classes (Carnivore, Herbivore, and Plant) that extend another class (Organism). How can I tell which subclass an
Carnivore
Herbivore
Plant
Organism
Java has an instanceof operator. However, that type of thing can be contrary to object-oriented design.
instanceof