Java: how to tell if an object is of a specific subclass.
I want to have a check to see if an object is of a particular subclass and have the check NOT come back true for other classes that have inherited from the same superclass.
So, for example:
superclass: fruit
subclass: apple and banana extend fruit
Then I have a check (if appleObject.isThisClass(apple)) {do stuff}
So far all I've been able to find are ways to check that will still return true because they share the same superclass.
Hopefully that makes sense.
Thanks for the help.