$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #234

What is the output?

int x = 5;
x = x++;
System.out.println(x);
  1. 5
  2. 6
  3. 4
  4. 7
x++ yields the old value 5, then the assignment writes that 5 back over the incremented x.
Play Problem Solving ▸