Ya you are right Ganesh...
Integer i=122;
means
you are calling:
Integer i=Integer.valueOf(122);
If you see source code of Integer class, you will find:
public static Integer valueOf(int i) {
final int offset = 128;
if (i >= -128 && i <= 127) { // must cache
return IntegerCache.cache[i + offset];
}
return new Integer(i);
}
You can see this code taking Integer Object from the cache.
private final int value;
public Integer(int value) {
this.value = value;
}
And if you see constructor then it is setting value of final int;
I think you have got the whole concept.
[ December 10, 2008: Message edited by: Punit Singh ]