Menu
Question Index
...

What will be the output of the following program?

class PrintFormation
{
    public static void main(String[] args)
    {
        for (int i = 0; i < 5; i++)
        {
            for (i = 0; i < 4; i++)
            {
                System.out.print(i + " ");
            }
        }
    }
}


0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3
0 1 2 3
Compilation Error
Goes into infinite loop

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App