The instanceof keyword returns true if what’s on the left is a class, subclass or interface of what’s on the right. Like this:

someObject instanceof someClass;

This lets you quickly check if an object is related to another class or interface! I honestly don’t use it very often, but it can be very helpful for certain situations.

#java

instanceof Java Keyword Tutorial
1.05 GEEK