For Loop With Post-Decrement Condition
How many times will the body of the for loop execute when the following code is run?
public class LoopExample20 {
public static void main(String[] args) {
int count = 0;
for (int i = 10; i-- > 5; ) {
count++;
}
System.out.println(count);
}
}
A
7
B
5
C
4
D
6
Question Leaderboard
Not enough data yet to show leaderboard.
