A-A+
运行下面的程序时 会产生()。 public class Test{ public stat
问题详情
运行下面的程序时,会产生()。 public class Test{ public static void main(String args[ ] ) { int x =0; int y = 2/x; int z[ ] = {1,2,4,6}; int p=z[4]; } }
A.ArrayIndexOutOfBoundsExcePtion异常
B.NumberFormatException异常
C.ArithmeticException异常
D.ArithmeticException异常和ArrayIndexOutOfBoundsExcePtion异常请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:C
解析:只能出现ArithmeticException异常,由于在程序第4行出现了这个异常后,程序就跳出,不能继续执行下去,因此不会出现ArrayIndexOutOfBoundsException异常。