🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java Control Flow: all 10 questions

Quiz: Java Control Flow · Question 4 of 10

What does this print? (code)

What does this print?

public class Main {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 0; i < 10; i += 3) {
            count++;
        }
        System.out.println(count);
    }
}
  1. A.3
  2. B.4
  3. C.10
  4. D.5
Answer & explanation

Correct answer: 4

i takes 0, 3, 6, 9 — four rounds.

Can you get the rest right without peeking?

Take the timed Quiz: Java Control Flow quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →