class Test
{
public static void main(String[] args)
{
try
{
int a[]= {1, 2, 3, 4};
for (int i = 1; i <= 4; i++)
{
System.out.println ("a[" + i + "]=" + a[i] + "\n");
}
}
catch (Exception e)
{
System.out.println ("error = " + e);
}
catch (ArrayIndexOutOfBoundsException e)
{
System.out.println ("ArrayIndexOutOfBoundsException");
}
}
}
(A)编译器错误
(B)运行时错误
(C) ArrayIndexOutOfBoundsException
(D)打印错误代码
(E)列印阵列答案: (A)
说明: ArrayIndexOutOfBoundsException已被基类Exception捕获。当在基类异常之后提到子类异常时,就会发生错误。
这个问题的测验