The instanceof keyword checks whether an object is an instance of a specific class or interface.
Source Code
String name = "Java";
boolean result = name instanceof String; // true
System.out.println(result);
Use instanceof for type checking in your code, especially before casting objects to a specific class.