instanceof java meaning code example
Example 1: instanceof java
class Example{
public static void main(String args[]){
Example anexample=new Example();
System.out.println(anexample instanceof Example);
}
}
Example 2: instance of keyword
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 .