Menu
Topics Index
...
`

While output822


If you need explanation Read this topic

If you need Answer Take test on this topic

While output822
What will be the output of the program?
class Output
{
    public static void main(String [] args)
    {
        int I = 0;
        outer:
            while (true)
            {
                I++;
                inner:
                    for (int i = 0; i < 10; i++)
                    {
                        I += i;
            
                        if (i == 0 || i == 1 || i == 2 || i == 3)
                            continue inner;
                        break outer;
                    }
                    continue outer;
            }
            System.out.println(i);
    }
}

A. 1
B. 0
C. 3
D. 11
E. Compilation error
Topic: Using break In Nested Loop Java Program

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

ans e.compilation err.
i varible not found.
i is declrd n initialized inside loop.
outside not accessible.

Posted by Maheshwari Natarajan    2014-08-05 09:06:06


Ans is E..continue outer is not possible after break outer which raises a compilation error

Posted by Badam Swathi    2014-08-05 09:06:28


Congratulations Maheshwari Natarajan. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-08-06 04:51:33


© meritcampus 2019

All Rights Reserved.

Open In App