Menu
Question Index
...

What will be the output of the following program?

public class Next
{
    public static void main(String... argsssss)
    {
        int i = 0;
        while (1)
        {
            if (i == 4)
                break;
            ++i;
        }
        System.out.println("i = " + i);
    }
}


i = 0
i = 1
i = 3
i = 4
Compilation Error or Runtime Error

Doubts

Problems

Topic: Using Break In for Loop To Exit

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App