What does this print?
<code>int x = 0; for (int i = 0; i < 5; i++); x++; System.out.println(x); </code></pre>
- A
0
- B
5
- C
Infinite
- Dcheck_circle
1
Explanation
Trailing <code>;</code> ends the for loop. <code>x++;</code> runs once, after the loop.
AP Computer Science A· difficulty 4/5
What does this print?
<code>int x = 0; for (int i = 0; i < 5; i++); x++; System.out.println(x); </code></pre>
0
5
Infinite
1
Explanation
Trailing <code>;</code> ends the for loop. <code>x++;</code> runs once, after the loop.
Want 10 more like this — adaptive to your weak spots?