The difference between an int and an integer is, in large terms, the difference between the basic data type and its wrapper class:
int is the basic type, the value is stored directly, and the integer is the object, pointing to the object with a reference
Data types in 1.Java are divided into basic data types and complex data types
int is the former and the integer is the latter (that is, a class), so the variables of the int class are initially 0 when the class is initialized. The integer variable is initialized to null.
2. When initializing:
int i =1;integer i= new Integer (1);(to look at Integer as a class); but because of the automatic packing and unpacking
Makes it possible to use the Integer class: integer i= 1;
int is the basic data type (the trace left for the process, but a useful addition to Java), an Integer is a class, an int extension, and a lot of conversion methods are defined.
Reference URL: http://www.cnblogs.com/shenliang123/archive/2011/10/27/2226903.html
The difference between int and integer in Java