How many times will the following code print "Welcome to Java"?
int count = 0;
do {
System.out.println("Welcome to Java");
} while (++count < 10);
a. 8
b. 9
c. 10
d. 11
e. 0
c The count is initialized to 0 before the loop. The loop is executed for the first time when count is 0 . (++count < 10) increments count by 1 and uses the new count value to check if count < 10 . So, the loop is executed 10 times for count from 0 to 9 . Note that when count is 9, ++count becomes 10, the loop exits. The correct answer is D.
You might also like to view...
The default Theme setting is:
A) the Microsoft Theme. B) there is no default. C) the Office Theme. D) the Windows Theme.
What content control enables you to choose from one of several existing entries?
A) Drop-Down list B) Check Box C) Option button D) Date Picker