Menu
Question Index
...

What will the output of the following program?

public class ForTest
{
    public static void main(String[] args)
    {
        for (int i = 1; i <= 10; i++)
        {
            if (i % 2 == 0) continue;
            if (i == 9) break;
            System.out.println(100 + i);
        }
    }
}


1001
1003
1005
1007
1009
101
103
105
107
1001
1003
1005
1007
Compilation Error
Goes into infinite loop

Doubts

Problems

Topic: Java for loops vs Java while loops vs Java do while loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App