Menu
Question Index
...

What will be the output of the following program?

class ArrayOutput
{
    public static void main(String s[])
    {
        int i = 50;
    
        int[] a = new int[10];
        System.out.println(a.length);  
    
        a = new int[100];
        System.out.println(a.length);
    
        a = new int[i];
        System.out.println(a.length);
    }
}


10
100
50
10
10
10
Compilation Error
Throws ArrayIndexOutOfBoundsException

Doubts

Problems

Topic: Java Array Initialization

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App