/**
* After jdk1.5, Java provides automatic unboxing for basic data types to corresponding application data types
* Whether auto-unpacking or auto-boxing is a method of applying a data type, the base data type is no method callable
* Conceptually, unpacking is from the application data type to the basic data type, boxing from the base data type to the application data type
*/
An automatic boxing operation is performed, the actual is: Integer I1 = integer.valueof (100);
The ValueOf method caches the object when the value is between 128 and 127, if it does not exist in the cache, creates if it exists, and does not create a direct fetch
Integer i1 = 100;
The action that was actually taken by this operation is: int i2 = I1.intvalue (), an automatic unpacking operation occurred
int i2 = I1;
/**
* All the following conditions will appear
* Number outside the -128~127
Integer i1 = 200;
Integer i2 = 200;
System.out.println ("I1==i2:" + (I1==I2)); The result is false
The number within the -128~127
Integer i3 = 100;
Integer i4 = 100;
System.out.println ("I3==i4:" + (I3==I4)); Result is True
*/
Integer i3 =new integer (100);
Integer i4 =new integer (100);
System.out.println ("I3==i4:" + (I3==I4));//Display False
This occurs because automatic unboxing and auto-boxing operations do not occur on the
In fact, the other seven kinds should also be boxed unpacking operation, here do not do a demonstration, interested can see the source code
Java Packing and unpacking parsing