hello,
in the chap 3 :Assignment(autoboxing),
the following code having an doubt
class
Test {
public static void main(
String [] args)
{
/*
Integer i1 = new Integer(1000);
Integer i2 = new Integer(1000);
Integer i3 = new Integer(10);
Integer i4 = new Integer(10);
*/
Integer i1 = 1000;
Integer i2 = 1000;
Integer i3 = 10;
Integer i4 = 10;
if(i1 == i2 )
System.out.println(" 1000== 1000");
else
System.out.println("1000 != 1000");
if(i3 == i4 )
System.out.println(" 10== 10");
else
System.out.println("10 != 10");
}
}
Commented codes gives different output from the give code. Why, The explanation given in the book is not cleared. Please help