Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

instanceof Comparison
 The instance of operator is used bassically for object reference variable only and we can use it for checking whether an object is of a perticular type.if the object referred to by the variable on the left side of the operator passes the IS-A test for the class or interface type on the right
side.we can see in this example : 
public static void main (String [] args) {
String s = new String("foo");
if (s instanceof String) {
System.out.print("s is a String");
}
}
       
Posted By: Name:Rajesh Kr URL: instanceof Comparison