instanceof
The instanceof keyword tests whether an expression can be cast into a type.
Purpose
This keyword is used to test whether an expression can be cast into a referenced type.
Syntax
expression instanceof type
Description
Use the instanceof operator to test whether the passed expression (an operand of instanceof) can be cast into the passed type (another operand of instanceof) without raising a ClassCastException exception. If the expression is passed successfully, this test returns true. It returns false if the test is unsuccessful.
Example
if (equipment instanceof Multiplex) {
note("Multiplex detected.");
}