Menu
Question Index
...

What will be the output of the program?

class Output
{
    public static void main(String s[])
    {
        int i = 1, j = 10;
        
        do
        {
            if(i > j)
                break;
            j--;
    
        } while (++i < 5);
    
        System.out.println("i = " + i + " and j = " + j);
    }
}


i = 6 and j = 5
i = 5 and j = 5
i = 6 and j = 4
i = 5 and j = 6

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