0 votes
in JAVA by
What is Java instanceOf operator?

1 Answer

0 votes
by

The instanceof in Java is also known as type comparison operator because it compares the instance with type. It returns either true or false. If we apply the instanceof operator with any variable that has a null value, it returns false. Consider the following example.

class Simple1{  

 public static void main(String args[]){  

 Simple1 s=new Simple1();  

 System.out.println(s instanceof Simple1);//true  

 }  

}  

Related questions

0 votes
asked Jul 2, 2023 in JAVA by rajeshsharma
0 votes
asked Jul 2, 2023 in JAVA by rajeshsharma
...