What does this print?
<code>int x = 3; int y = ++x + x++; System.out.println(x + " " + y); </code></pre>
- A
4 7
- B
4 8
- Ccheck_circle
5 8
- D
5 7
Explanation
++x: x=4, expr=4. x++: expr=4, x=5. y = 4 + 4 = 8. Final: x=5, y=8.
AP Computer Science A· difficulty 4/5
What does this print?
<code>int x = 3; int y = ++x + x++; System.out.println(x + " " + y); </code></pre>
4 7
4 8
5 8
5 7
Explanation
++x: x=4, expr=4. x++: expr=4, x=5. y = 4 + 4 = 8. Final: x=5, y=8.
Want 10 more like this — adaptive to your weak spots?