Menu
Question Index
...

What will be the output of the following program?

public class IntelInside
{
    public static void main(String[] args)
    {
        int j = 6;
        for (int i = 0, j = 5; i < 5; i++, j--)
        {
            System.out.print(i + " " + j + ", ");
        }
    }
}


0 5, 1 4, 2 3, 3 2, 4 1,
0 6, 1 5, 2 4, 3 3, 4 2,
0 5, 1 5, 2 5, 3 5, 4 5,
Compilation Error
Runtime Error

Doubts

Problems

Topic: for Loop In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App