What is printed by:
<code>int x = 5; System.out.println(x++); </code></pre>
- A
6
- B
0
- C
Nothing
- Dcheck_circle
5
Explanation
Post-increment returns the original value, then increments. <code>x</code> becomes 6 after, but 5 is printed.
AP Computer Science A· difficulty 4/5
What is printed by:
<code>int x = 5; System.out.println(x++); </code></pre>
6
0
Nothing
5
Explanation
Post-increment returns the original value, then increments. <code>x</code> becomes 6 after, but 5 is printed.
Want 10 more like this — adaptive to your weak spots?