Menu
Question Index
...

What exception does LINE A throw?

class ArrayExample
{
    public static void main(String s[])
    {
        int[] a = null;
        int total = a[1] + a[2] + a[3]; // LINE A

        System.out.println("Total = " + total);
    }
}


ArithmeticException
ArrayIndexOutOfBoundsException
NullPointerException
No exception will be thrown

Doubts

Problems

Topic: Why Java Throws Exceptions

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App