I understand that int values, when autoboxed, are interned i.e no 2 objects containing the same int are present, and so we can compare two Integers by == So why does the following happen :
Integer iRef1=1000;
Integer iRef2=1000;
System.out.println(iRef1 == iRef2);
System.out.println(iRef1.equals(iRef2));
This prints
false
true
On the other hand, if I say
Integer iRef1=10;
Integer iRef2=10;
System.out.println(iRef1 == iRef2);
System.out.println(iRef1.equals(iRef2));
the output is
true
true
Why is there no interning in the second case ?