Menu
Question Index
...

What will be the output of the following program?

class ArrayOutput
{
    public static void main(String s[])
    {
        int[][] input = {{3, 5, 6, 7}, {2, 4}, {1}, {2, 3, 4, 5}, {5, }};
        int  result = 1;

        for(int i = 0; i < input.length; i++)
        {
            for(int j = 0; j < input[0 + 2].length; j++)
            {
                result *= input[i][j];
            }
        }
        System.out.println("Result = " + result);
    }
}


Result = 60
Result = 12
Result = 1
Compilation Error
Throws ArrayIndexOutOfBoundsException

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