Hi,
The integer values from -128 to 127 are stored into a pool just like
String pool. So, for those values, when you do
Integer i1 = 100; it is actually
Integer.valueOf(100); which creates an Integer object with value as 100 and adds it to the pool. When
Integer i2 = 100; is executed, an Integer object with value as 100 will be available in the pool and that will be used.
Hope this helps.
[ September 21, 2007: Message edited by: Vinayagar Karpagam ]