0 votes
in JAVA by
Which of the following is the correct syntax for a while loop in Java?

a) while (x < 10) {

System.out.println(“Hello”);

}

b) do {

System.out.println(“Hello”);

} while (x < 10);

c) for (int i = 0; i < 10; i++) {

System.out.println(“Hello”);

}

d) while (x < 10) System.out.println(“Hello”);

Solution: a) while (x < 10) {

System.out.println(“Hello”);

}

1 Answer

0 votes
by

Explanation: The while loop executes the block of code while the specified condition is true.

Related questions

0 votes
asked May 4 in JAVA by rahuljain1
0 votes
asked Jan 24, 2021 in JAVA by rajeshsharma
...