Java |异常处理|问题6

null

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] + "" );
}
}
catch (Exception e)
{
System.out.println ( "error = " + e);
}
catch (ArrayIndexOutOfBoundsException e)
{
System.out.println ( "ArrayIndexOutOfBoundsException" );
}
}
}


(A) 编译错误 (B) 运行时错误 (C) 数组下标越界异常 (D) 错误代码被打印出来 (E) 阵列已打印 答复: (A) 说明: ArrayIndexOutOfBoundsException已被基类异常捕获。当在基类异常之后提到子类异常时,就会发生错误。 这个问题的小测验

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享