Consider the Java code:
Integer i = 3;
foo(i);
System.out.println("i = " + i);
void foo (Integer j) {
j++;
System.out.println("j = " + j);
return; }
Integer is immutable. What is printed?
Answer: D
A pointer to the Integer 3 is passed by value; an Integer 4 (in this case, in the Integer cache) must be found or created for the j++; the original value of i is unchanged.