instanceof operator
instanceof operator is also known as type comparison operator. It compares an object with any specific type(may be class, interface etc.). It returns either true or false.
It is used to test whether given object is an instance of specified class or not.
Example :
class Test{
public static void main(String args[]){
Test t=new Test();
System.out.println(t instanceof Test ) ;
}
Output :
true
0 comments: