An Integer is immutable (its value cannot be changed).

Suppose we do:


Integer i = 3;
Integer j = i;
i++;
System.out.println("i = " + i + ", j = " + j);

What values are printed?

  • A: i = 4, j = 4
  • B: i = 4, j = 3
  • C: i = 3, j = 4
  • D: i = 3, j = 3
  • E: error

    Answer

    Prev    Next    Page+10