The instanceof keyword checks whether an object is an instance of a specific class or an interface . The instanceof keyword compares the instance with type. The return value is either true or false .
Read moreIs Instanceof Java slow?
Instanceof is very fast . It boils down to a bytecode that is used for class reference comparison. Try a few million instanceofs in a loop and see for yourself.
Read more