What is the difference between Integer.class, Integer.TYPE and int.class?
acc to me
Integer.class i
In plain terms :
int -- > Are primitives..for simple math operations. You cannot add them to a collection.
Integer --> Are objects in themselves.. are wrappers to ints. i.e, they can be used with collections (as they are objects). They are collected as normal objects by the GC.
EDIT :
public static void main(String[] args) {
int i = 5;
System.out.println(int.class);
Integer i1 = new Integer(5);
System.out.println(Integer.TYPE);
}
O/P : int
int
So, basically, both return an int. Integer.TYPE just returns the primitive type of the Integer class. It is true for any wrapper class