Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 5: Writing Classes
Start Practice TestPractice Test
About Exam
hard

For Loop With Post-Decrement Condition

Mark
< Prev
Next >

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

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|