A-A+

下列代码段在运行时会产生______异常。 public class ex32 { publ

2022-08-05 21:21:03 问答库 阅读 172 次

问题详情

下列代码段在运行时会产生______异常。 public class ex32 { public static void main(String[] args) { int a[] = {1, 23, 24, 56, 37, 9, 12}; for(int k = 0; k < a.length; k++) { if(a[k] > a[k + 1]) { int x = a[k]; a[k] = a[k + 1]; a[k + 1] = x; } } } }
A.NumberFormatException
B.ArithmeticException
C.ArrayIndexOutOfBoundsException
D.IOException请帮忙给出正确答案和分析,谢谢!

参考答案

正确答案:C

考点:时会,代码