For Loop Initial Condition
Which of the following is an example of a for loop that does not execute its body because the loop condition is false from the start?
public class NoIteration {
public static void main(String[] args) {
for (int i = 10; i < 5; i++) {
System.out.println(i);
}
}
}
A
for (int i = 10; i < 5; i++) {
System.out.println(i);
}
B
while(false) {
System.out.println("Never executes");
}
C
for (int i = 10; i > 5; i--) {
System.out.println(i);
}
D
for (int i = 10; i < 15; i++) {
System.out.println(i);
}
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | sgarv2513 | 1 | 1 | 0m 00s | 100 |
| #2 | hitrishabhatia | 1 | 2 | 0m 00s | 90 |
| #3 | y.seong2027 | 1 | 2 | 0m 52s | 38 |
| #4 | suhanakochhar006 | 1 | 2 | 0m 52s | 38 |
APFIVE