Java instance of an operator:

  • The instance is an object reference operator and returns a Boolean value that is true or false if the object on the left-hand side is an instance of the class given on the right-hand side.
  • This operator allows us to determine whether the object belongs to a particular class or not.


name instanceof String Is true if the object person belongs to the class employee, otherwise it is false.

class InstanceDemo
    public static void main(String args[])
        String name="Tapuuu";
        boolean x=name instanceof String;

Output :


Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 9439202111  |  9658317757  |  0674-2361252