Alex Rivera | Logout

Java - is there a "subclassof" like instanceof?

Asked 2010-04-23T15:25:04.287
30

Im overriding an equals() method and I need to know if the object is an instance of a Event's subclass (Event is the superclass). I want something like "obj subclassof Event". How can this be made?

Thanks in advance!

Edit
Report

1 Answer

0

If obj is a subclass of Event then it is an instanceof. obj is an instanceof every class/interface that it derives from. So at the very least all objects are instances of Object.

answered 2010-04-23T15:27:44.570

Your Answer