do {
System.out.println(i);
i++;
} while (i < 0);Which loop is equivalent in behavior when i starts at 5?
- A
An infinite loop
- B
No iterations occur
- Ccheck_circle
System.out.println(5); i = 6; (loop runs exactly once)
- D
Loop runs five times
Explanation
A do-while runs at least once and only repeats while the condition is true. Starting at 5 the body runs once, prints 5, increments to 6, and 6 < 0 is false.