Hi 2 every1,
Wht is the purpose of insanceof operator???plz gv a code????
Wht is the purpose of insanceof operator???plz gv a code????
public void getObj(Object obj)
{
if (obj instanceof String)
{
System.out.println("You have passed in a String");
}
else if (obj instanceof int)
{
System.out.println("You have passed in an integer");
}
}
public void getObj(Object obj)
{
if (obj instanceof String)
{
System.out.println("You have passed in a String");
}
else if (obj instanceof int)
{
System.out.println("You have passed in an integer");
}
}
Comment