0
What is the output of the following Java code?
public class Test {
public static void main(String[] args) {
try {
int[] arr = new int[5];
arr[10] = 50;
} catch (ArithmeticException e) {
System.out.println("Arithmetic");
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("ArrayIndex");
} finally {
System.out.println("Finally");
}
}
}
- AArithmetic Finally
- BArrayIndex Finally
- CFinally only
- DCompilation error, unreachable catch block
Correct answer: B