Java, difference between Integer.TYPE and int.class

2

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<?> .

    
asked by anonymous 31.10.2015 / 02:54

1 answer

2

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");
    
02.08.2016 / 18:35