【单选题】【消耗次数:1】
运行下面程序时,会产生什么异常?( ) public class X7_1_5 { public static void main(String[] args) { int[] z = { 1,2,3,4 } ; int p = z[4]; int x = 0; int y = 5/x; } }
ArithmeticException
NumberFormatException
ArrayIndexOutOfBoundsException
IOException
参考答案:
复制
纠错
相关题目
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_4 { public static void main(String[] args) { int x = 0; int y = 5/x; int[] z = { 1,2,3,4 } ; int p = z[4]; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 下列程序的运行结果是( ) 。 public class X5_1_2 extends x{ int ab() { static int aa=10; aa++; System.out.println(aa); } public static void main(String[] args) { X5_1_2 x=new X5_1_2(); x.ab(); } }
①  10
②  11
③  编译错误
④  运行成功,但不输出
【单选题】 已知有下面类的说明: public class X5_1_1 extends x{ private float f =10.6f; int i=16; static int si=10; public static void main(String[] args) { X5_1_1 x=new } } X5_1_1(); 在 main()方法中,下面哪条语句的用法是正确的?( )
①  x.f
②  this.si
③  X5_1_1.i
④  X5_1_1.f
【单选题】 关于以下application的说明,正确的是( ) 1. class StaticStuff 2. { 3. static int x=10; 4. static { x+=5;} 5. public static void main(String args[ ]) 6. { 7. System.out.println(“x=” + x); 8. } 9. static { x/=3;} 10. }
①  4行与9行不能通过编译,因为缺少方法名和返回类型
②  9行不能通过编译,因为只能有一个静态初始化器
③  编译通过,执行结果为:x=5
④  编译通过,执行结果为:x=3
【单选题】 编译运行以下程序后,关于输出结果的说明正确的是 ( ) public class Conditional{ public static void main(String args[ ]){ int x=4; System.out.println(“value is “+ ((x>4) ? 9.9:9)); } }
①  输出结果为:value is 99.9
②  输出结果为:value is 9
③  输出结果为:value is 9.0
④  编译错误
【单选题】 写出下面程序的执行结果。main(){ int x=1,y=1,z=0;if(z0)if(y0) x=3;else x=5;printf(%d\tif(z=y0) x=3;else if(y= =0 ) x=5;else x=7;printf(%d\tprintf(%d\t}
①  1 5 1
②  1 7 0
③  3 7 0
④  5 5 0
【单选题】 写出下面程序的执行结果。main(){ int x=1,y=1,z=0;if(z0)if(y0) x=3;else x=5;printf(%d\tif(z=y0) x=3;else if(y= =0 ) x=5;else x=7;printf(%d\tprintf(%d\t
①  1 7 0
②  3 7 0
③  5 5 0
④  1 5 1
【单选题】 写出下面程序的执行结果。main(){ int x=1,y=1,z=0;if(z0)if(y0) x=3;else x=5;printf(%d\tif(z=y0) x=3;else if(y= =0 ) x=5;else x=7;printf(%d\tprintf(%d\t}
①  1 5 1
②  3 7 0
③  5 5 0
④  1 7 0
【单选题】 写出下面程序的执行结果。main(){ int x=1,y=1,z=0;if(z0)if(y0) x=3;else x=5;printf(%d\tif(z=y0) x=3;else if(y= =0 ) x=5;else x=7;printf(%d\tprintf(%d\t}
①  1 7 0
②  3 7 0
③  5 5 0
④  1 5 1
【单选题】 下面代码运行后的输出结果为( ) 。 public class X6_1_5 { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(b@@equals(aa)); } } class AB{ int x = 100; }
①  true
②  false
③  编译错误
④  100
随机题目
【判断题】 Jim read books in the study now.
①  正确
②  错误
【判断题】 She’s much intelligent than me.
①  正确
②  错误
【判断题】 He are cooking the dinner.
①  正确
②  错误
【判断题】 The leaves are turning green in spring.
①  正确
②  错误
【判断题】 I don’t know what you are talking about.
①  正确
②  错误
【单选题】 I go to the gym [填空] a week.
①  one
②  first
③  once
④  two
【单选题】 I [填空] it about two days ago.
①  have
②  has
③  had
④  having
【单选题】 He said the sun [填空] in the east and [填空] in the west.
①  rose,set
②  rises,sets
③  rises,set
④  rise,sets
【单选题】 Tom is not very keen [填空] studying.
①  in
②  on
③  at
④  for
【单选题】 Let’s [填空] this music, shall we?
①  listen
②  listens
③  listen to
④  listens to