Originally posted by rakhee gupta:

...Why i1 and i2 are different objects when both are Integer and have value 1000 which is in the range of int...

To get the same reference when autoboxing, the values need to be within the range of a byte.

JLS 5.1.7 - Boxing Conversion...

If the value p being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or **an int or short number between -128 and 127,** then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2.

My **bold.**