While Loop Bounds
A program evaluates a while loop condition and updates an integer variable until the condition is no longer met.
What is printed when the following Java program is compiled and run?
public class QuestionTrace {
public static void main(String[] args) {
int x = 2;
while (x < 10) {
x += 3;
}
System.out.println(x);
}
}
A
8
B
10
C
9
D
11
Question Leaderboard
Not enough data yet to show leaderboard.
