What's the difference between using Integer.TYPE
and int.class
?
I made some tests and both can be passed as a parameter to a Class<?>
.
What's the difference between using Integer.TYPE
and int.class
?
I made some tests and both can be passed as a parameter to a Class<?>
.
The Integer.TYPE and the int.class are the same thing.
If you execute the following snippet, you will see that the return is true.
System.out.println(Integer.TYPE.equals(int.class));
The definition of Integer.TYPE is as follows:
public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int");