Code Snippet
public class WrapperClass {
public static void main(String[] args) {
Integer i1 = 400;
Integer i2 = i1;
i1++;
System.out.println(i1 + " " + i2);
}
}
Output is 401 400
. I am not sure how wrapper objects work. Arent i1 and i2 pointing to same object ? What happens on java heap when the above code executes ?