how to check data type in java code example
Example 1: java check data type
a.getClass().getName()
Example 2: get type of variable java
((Object) myVar).getClass().getName()
//OR
((Object) myInt).getClass().getSimpleName()
Example 3: java typeof
Object obj = null;
obj = new ArrayList<String>();
System.out.println(obj.getClass());
obj = "dummy";
System.out.println(obj.getClass());
obj = 4;
System.out.println(obj.getClass());