Menu
Question Index
...

What will be the output of the following program?

public class Statement
{
    public static void main(String[] args)
    {
        int[] numbers = {10, 20, 30, 40, 50, 60, 70, 80, 90};
        for (int x : numbers)
        {
            if (x == 30 || x == 60 || x == 90 || x == 120)
            {
                continue;
            }
            System.out.print(x + " ");
            continue;    // LINE 1
            break;        // LINE 2
            continue;    // LINE 3
        }
    }
}


10 20 40 50 70 80
10 20 30 40 50 60 70 80 90
Compilation Error at LINE 1
Compilation Error at LINE 2
Compilation Error at LINE 3

Doubts

Problems

Topic: For-each Loop In Core Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App