How to identify object types in java
You forgot the .class: if (value.getClass() == Integer.class) { System.out.println(“This is an Integer”); } else if (value.getClass() == String.class) { System.out.println(“This is a String”); } else if (value.getClass() == Float.class) { System.out.println(“This is a Float”); } Note that this kind of code is usually the sign of a poor OO design. Also note that comparing the … Read more