while Loops

AP Computer Science A· difficulty 3/5

What does this print?

<code>int i = 5; do { System.out.print(i); } while (i < 3); </code></pre>

  • A

    5

    check_circle
  • B

    Nothing

  • C

    5 (compile error)

  • D

    5 4 3

Explanation

do-while runs body once before checking; condition fails immediately after.

Want 10 more like this — adaptive to your weak spots?

Related questions