Multiple Choice Question

Quiz Guidelines

 

QID: 
408
Tags: 
Question: 

What will happen when the following code is compiled and run?

class AX{
static int[] x = new int[0];
static{
x[0] = 10;
}
public static void main(String[] args){
AX ax = new AX();
}
}

Select 1 option

A. It will throw NullPointerException at runtime.
B. It will throw ArrayIndexOutOfBoundsException at runtime.
C. It will throw ExceptionInInitializerError at runtime.
D. It will not compile.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!