Complete the code to start a do-while loop that prints "Hello" once.
do {
System.out.println("Hello");
} [1] (false);The do-while loop in Java uses the keyword while after the do block to specify the loop condition.
Complete the code to declare an integer variable i initialized to 0 before the do-while loop.
[1] i = 0; do { System.out.println(i); i++; } while (i < 3);
float or boolean instead of int.String for a number variable.In Java, int is used to declare integer variables like i.
Fix the error in the do-while loop condition to correctly check if i is less than 5.
int i = 0; do { System.out.println(i); i++; } while (i [1] 5);
The loop should continue while i is less than 5, so the condition uses the < operator.
Fill both blanks to create a do-while loop that prints numbers from 1 to 3.
int num = 1; do { System.out.println(num); num[1]; } [2] (num <= 3);
-- which would count down instead of up.if instead of while after the do block.The variable num is increased by 1 each loop using ++. The loop continues while num is less than or equal to 3 using while.
Fill all three blanks to create a do-while loop that prints "Count: x" for x from 1 to 4.
int count = [1]; do { System.out.println("Count: " + [2]); [3]; } while (count <= 4);
The variable count starts at 1. Inside the loop, it prints the current count and then increases it by 1 using count++.