单选8. 12-8. What exception type does the following program throw? public class Test { public static void main(String[] args) { int[] list = new int[5]; System.out.println(list[5]); } } (5分) A. A. ArithmeticException B. B. ArrayIndexOutOfBoundsException C. C. StringIndexOutOfBoundsException D. D. ClassCastException E. E. No exception 单选9.
时间: 2024-02-09 22:09:34 浏览: 105
FindMe-src.zip_Before_throw.m
8. B. ArrayIndexOutOfBoundsException
9. What is the output of the following program?
```java
public class Test {
public static void main(String[] args) {
try {
int[] list = new int[5];
System.out.println(list[5]);
} catch (ArrayIndexOutOfBoundsException ex) {
System.out.println("Out of Bounds");
} catch (Exception ex) {
System.out.println("Exception Caught");
}
}
}
```
(5分)
A. "Out of Bounds"
B. "Exception Caught"
C. Compiler Error
D. Runtime Error
E. No output
阅读全文