1
JavaBeginner#fundamentals#java10
It checks whether an object is an instance of a specific class or implements a given interface, returning a boolean, and is often used before casting to avoid ClassCastException.
Object obj = "hello";
if (obj instanceof String s) { // pattern matching (Java 16+)
System.out.println(s.length());
}