Java instanceof Operator

In this tutorial you will learn about the Java instanceof Operator and its application with practical example.

Java instanceof Operator

In Java, the instanceof Operator is used to determine whether an object is an instance of a class, a subclass or an interface or not.

Example:-

Output:-

java_instanceof_operator_example

When you run above java program, it will output true. It’s because str is the instance of String class.

Recommended:-  Java Datatype
In this tutorial we have learn about the Java instanceof Operator and its application with practical example. I hope you will like this tutorial.