Menu
Question Index
...

What will be the output of the following program?

public class Layout
{
    public static void main(String args[])
    {
        outer : for (int i = 1; i < 3; i++)
        {
            inner : for (int j = 1; j < 3; ++j)
            {
                if (j == 2)
                    continue outer;
                System.out.println("i = " + i + ", j = " + j);
            }
        }
    }
}


i = 1, j = 1
i = 2, j = 1
i = 1, j = 1
i = 1, j = 1
i = 2, j = 1
i = 0, j = 1
i = 1, j = 1
i = 2, j = 1
i = 1, j = 0
i = 1, j = 1
i = 2, j = 0
i = 2, j = 1
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java continue Statement

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App