Menu
Question Index
...

What will be the output of the following program?

class ArrayOutput
{
    public static void main(string s[])
    {
        int a[] = {12, 15, 16, 17, 19};

        for(int i = 5; i > 0; i--)
        {
            System.out.println(a[i]);
        }
    }
}


19
17
16
15
12
17
16
15
12
19
15
12
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