Andrew McDonough

Please note: This page is imported from my wiki, which hasn't been updated in over 10 years. Some of the formatting was lost during the import. I'll try to get around to fixing it someday.


In Java, instanceof is an operator to test whether an object is an instance of a particular class.

Note that this is not a method and is not to be confused with the method getInstanceOf() as found in the beans package. The operator must be in lower case not camel case.

If an object o is of class B, and class B inherits from class A, then o is an instanceof A as well as B

Andrew McDonough

Andrew McDonough is a consultant CTO and software developer, currently based between Berlin and London.

Follow Andrew on Twitter or Connect on LinkedIn