instanceof can be used to test if an object is a direct or descended instance of a given class. instanceof can also be used with interfaces even though interfaces can’t be instantiated like classes.
Read moreHow does Instanceof work in Java?
An instanceof in Java is a comparison operator which, given an object instance, checks whether that instance is of a specified type (class/sub-class/interface) or not . Just like other comparison operators, it returns true or false.
Read moreIs Instanceof keyword in Java?
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 a valid operator in Java?
In Java, instanceof is an operator which is used to check object reference . … It returns either true or false, if an object reference is of specified type then it return true otherwise false. We can use instanceof operator to check whether an object reference belongs to parent class, child class, or an interface.
Read more