The Type Comparison Operator instanceof
The Type Comparison Operator instanceof
The instanceof operator compares an object to a specified type. You can use it to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface.
When using the instanceof operator, keep in mind that null is not an instance of anything.
Semantic portal