Question: What exception does LINE A throw? class ArrayExample { public static void main ( String s [ ] ) { int [ ] a =

What exception does LINE A throw?
class ArrayExample
{
public static void main(String s[])
{
int[] a ={4,5,6};
int total = a[1]+ a[2]+ a[3]; // LINE A
System.out.println("Total ="+ total);
}
}
a. NullPointerException
b. ArithmeticException
c. No exception will be thrown
d. ArrayIndexOutOfBoundsException

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!