int x = 5;
int y = x++;
System.out.println(x + " " + y);What is printed?
- Acheck_circle
6 5
- B
5 5
- C
6 6
- D
5 6
Explanation
Post-increment x++ assigns the old value 5 to y, then increments x to 6.
AP Computer Science A· difficulty 2/5
int x = 5;
int y = x++;
System.out.println(x + " " + y);What is printed?
6 5
5 5
6 6
5 6
Explanation
Post-increment x++ assigns the old value 5 to y, then increments x to 6.
Want 10 more like this — adaptive to your weak spots?