Possible Duplicate:
How to determine an object's class (in Java)?
Java determine which class an object is
I have following sample incomplete method to compare the object type of a given object
public void test(Object value) {
if (value.getClass() == Integer) {
System.out.println("This is an Integer");
}else if(value.getClass() == String){
System.out.println("This is a String");
}else if(value.getClass() == Float){
System.out.println("This is a Float");
}
}
The method can be called as:
test("Test");
test(12);
test(10.5f);
this method is not actually working, please help me to make it work