运行下面的程序时,会产生( )。 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异常
A: ArrayIndexOutOfBoundsExcePtion异常
B: NumberFormatException异常
C: ArithmeticException异常
D: ArithmeticException异常和ArrayIndexOutOfBoundsExcePtion异常
举一反三
- 运行下面程序时,会产生什么异常?( )public class sdw{ public static void main(String[] args) {int x = 0;int y = 5/x;int[] z = {1,2,3,4};int p = z[3];}} A: ArithmeticException B: NumberFormatException C: ArrayIndexOutOfBoundsException D: IOException
- 运行下面程序时,会产生什么异常? public class X7 { public static void main(String[] args) { int x = 0; int y = 5/x; int[] z = {1,2,3,4}; int p = z[4]; } }
- 35 下面程序运行的结果是() public class X { private static int a; public static void main(String [] args) { modify(a); System.out.println(a); } public static void modify(int a) { a++; } } A: 0 B: 1 C: 程序编译失败 D: 程序抛出异常
- 关于下面的程序Test.java说法正确的是( )。 public class Test { String x='1'; int y; public static void main(String args[]) { int z=2; System.out.println(x+y+z); } }
- 仔细阅读程序,确定a,z的值? public class Example16{ public static void main(String[] args) { int x = 0; int y = 0; int z = 0; boolean a; a = x == 0 || z++ >1; System.out.println("a = " + a); System.out.println("z = " + z); } }