网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

如下代码:  public void Test() { try {  oneMethod();  System.out.println("condition 1");  } catch (ArrayIndexOutOfBoundsException e) {  System.out.println("condition 2");  } catch(Exception e) {  System.out.println("condition 3"); } finally {  System.out.println("finally"); }   }  如果oneMethod正常运行,则输出结果中是?()

  • A、 condition 1   finally
  • B、 condition 2   finally
  • C、 condition 3   finally
  • D、 finally

参考答案

更多 “ 如下代码:  public void Test() { try {  oneMethod();  System.out.println("condition 1");  } catch (ArrayIndexOutOfBoundsException e) {  System.out.println("condition 2");  } catch(Exception e) {  System.out.println("condition 3"); } finally {  System.out.println("finally"); }   }  如果oneMethod正常运行,则输出结果中是?()A、 condition 1   finallyB、 condition 2   finallyC、 condition 3   finallyD、 finally” 相关考题
考题 如下代码:publicvoidTest(){try{oneMethod();System.out.println(condition1);}catch(ArrayIndexOutOfBoundsExceptione){System.out.println(condition2);}catch(Exceptione){System.out.println(condition3);}finally{System.out.println(finally);}}如果oneMethod正常运行,则输出结果中是?()A.condition1finallyB.condition2finallyC.condition3finallyD.finally

考题 阅读下列程序片段。Public void test{Try{sayHello;system.out.println(hello):}catch(ArraylndexOutOfBoundException e){System.out.println(ArraylndexOutOfBoundExcep—tion);}catch(Exception e){System.out.println(Exception):}finally{System.Out.println(finally);}}如果sayHello方法正常运行,则test方法的运行结果将是( )。A.HelloB.ArraylndexOutOfBondsExceptionC.ExceptionFinallyD.HelloFinally

考题 已知如下代码: switch(m) { case 0: System.out.println("Condition0"); case 1: System.out.println("Condition 1"); case 2: System.out.println("Condition 2"); case 3: System.out.println("Condition 3"); break; default: System.out.println("Other cCndition"); } 当m为( )时,"Condition 2"会出现在输出结果中。A.2B.0、1C.0、1、2D.0、1、2、3

考题 在oneMethod( )方法运行正常的情况下,程序段将输出( )。 public void test( ){ try {oneMethod( ); System.out.println ("condition 1"); }catch (ArratlndexOutOfBoundException e){ System.out.println("condition2"): }catch (Exception e){ System.out.println("condition 3"); }finnally{ System.out.println("finally"): } }A.condition 1B.condition2C.condition 3D.condition 1 finally

考题 下面程序输出的结果是什么? ( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException(); }catch(Exception e) { System.out.println("It's caught!"); }finally{ System.out.println("It's finally caught!"); } } } class MyException extends Exception{}A.It's finally caught!B.It's caught!C.It's caught!/It's finally caught!D.无输出

考题 下列代码的执行结果是( )。 public class Test{ public static void main(String[]args){ int[]x={0,1,2,3}; for{int i=0;i3;1+=2){ try{ systcm.OUt.println(x[i+2]/x[i]+x[i+1]); }catch(ArithmeticException e){ System.OUt.println("errorl"): }catch(Exception e){ System.OUt.println("error2"): } } } }A.errorlB.error2C.errorl orror2D.2 error2

考题 下列程序的运行结果是( )。 public class test{ private String[]data={¨10","10.5"); public void fun{ double s=0: for(int i=0;i3;j++){ try{ s=s+Integer.parseInt(data[i]); catch(Exception e){ System.out.print("errorl:"+data[i]); } } } public static void main(string[]args){ try{ test d=new test: fun: }catch(Exception e){ System.OUt.println("error2") } } }A.errorl:10.5B.error2C.errorl:10.5 error2D.以上都不对

考题 如下的代码段中,如果方法unsafe()正常运行,那么结果是( )。 public void example() { try { unsafe(); System.out.println("Testl"); }catch(SafeException e) { System.out.println("Test 2"); }finally{ System.out.println("Test 3'); } System.out.println("Test 4"); }A.Test 3 Test 4B.Test1 Test3 Test4C.Test1 Test3D.Test1 Test4

考题 阅读下列程序片段。 Public void test{ Try{ sayHello; system.out.println("hello"): }catch(ArraylndexOutOfBoundException e){ System.out.println("ArraylndexOutOfBoundExcep— tion"); }catch(Exception e){ System.out.println("Exception"): }finally{ System.Out.println("finally"); } } 如果sayHello方法正常运行,则test方法的运行结果将是( )。A.HelloB.ArraylndexOutOfBondsExceptionC.Exception FinallyD.Hello Finally

考题 阅读下列程序片段 Publicvoidtest(){ Try{ sayHello(); system.out.println(“hello"); }catch(ArrayIndexOutOfBoundExceptione){ System.out.println(“ArraylndexOutOfBoundException”); }catch(Exceptione){ System.out.println(“Exception”); }finally{ System.out.println(“finally”); } } 如果sayHello()方法正常运行,则test()方法的运行结果将是( )。A.HelloB.ArraylndexOutOfBondsExceptionC.Exception FinallyD.Hello Finally

考题 下列程序的输出结果是( )。 Public class Test{ Public static void main(String[]args){ int[]array=(2,4,6,8,10); int size=6; int result=-l: try{ for(int i=0;isizeresult= =-1:) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch---1"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch---2"): } catch(Exception e){ System.out.println("Catch---3"): } }A.Catch---1B.Catch---2C.Catch---3D.以上都不对

考题 请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是( )。 程序代码: public class throwsExeeption{ static void Proc(intsel) throws Arithmetic Exception,Array Index Out Of Bounds Exception{ System.out.println("InSituation"+sel); if(sel= =0){ System.OUt.println("noException caught"); return; } else if(sel= =l){ int iArray[]=newint[4]; iArray[1]=3; } } public static void main(String args[]){ try{ Proe(O); Proc(1); } catch(Array Index Out Of Bounds Exception e){ System.out.println("Catch"+e); } finally{ System.out.println("inProcfinally"): } } } 执行结果: In Situation 0 no Exception caught in Proc finallyA.In Situation lB.In SituationC.with CatchD.int iArray l

考题 下列程序的输出结果是( )。 public class Test{ public static void main(String[]args){ int[]array=(2,4,6,8,lO); int size=6; int result =-1: try{ for(int i=0;i(size 8Lresult= = -1;) if(array[i]= =20)result=i: } catch(ArithmeticException e){ System.out.println("Catch- - -l"); } catch(ArraylndexOutOfBoundsException e){ System.out.println("Catch- - -2"); } catch(Exception e){ System.out.println("Catch- - -3");) } }A.Catch- - -1B.Catch- - -2C.Catch- - -3D.以上都不对

考题 在oneMethod( )方法运行正常的情况下,程序段将输出什么? public void test( ){ try { oneMethod( ); System.out.println("condition 1"); } catch (ArrayIndexOutOfBoundsException e){ System.out.println("condition 2"); } catch(Exception e){ System.out.println("condition 3"); } finally { System.out.pritln("finally"); } }A.condition 1B.condition 2C.condition 3D.condition 1

考题 在oneMethod()方法运行正常的情况下,程序段将输出______。 public void test() { try{ oneMethod(); System.out.println("ndition 1"; } catch (ArrayIndexOutOfVoundsException e){ System.out.println("ondition 2"; } catch (Exception e){ System.out.println("ondition 3"; } finally{ System.out.println ( "inally"; } }A.condition1B.condition2C.condition3D.condition1 finally

考题 在oneMethod()方法运行正常的情况下,程序段将输出什么? ( ) public void test() { try { oneMethod(); System.out.println("condition 1"); } catch(ArrayIndexOutOfBoundsException e) { System.out.println("condition 2"); } catch(Exception e) { System.out.println("condition 3"); } finally { System.out.println("finally");A.condition 1B.condition 2C.condition 3D.condition 1 finally

考题 ( 17 )下列程序的输出结果是public class Test{public static void main(String[] args){int [] array={2,4,6,8,10};int size=6;int result=-1;try{for{int i=0;isize result==-1;i++}if(array[i]==20) result=i;}catch(ArithmeticException e){System.out.println( " Catch---1 " );catch(ArrayIndexOutOfBoundsException e){System.out.println( " Catch---2 " );catch(Exception e){System.out.println( " Catch---3 " );}}A ) Catch---1B ) Catch---2C ) Catch---3D )以上都不对

考题 public void test() {     try { oneMethod();  System.out.println("condition 1");  }  catch (ArrayIndexOutOfBoundsException e) {     System.out.println("condition 2");     }  catch(Exception e) {  System.out.println("condition 3");     }  finally {  System.out.println("finally");    }  }  Which will display if oneMethod run normally?()    A、 condition 1B、 condition 2C、 condition 3D、 finally

考题 public class TestApp{   public static void main(String[] args){   try{   int i = 0;   int j = 1 / i;   System.out.println(“1”);   } catch(Exception e){   System.out.print(“3”);   } finally{   System.out.print(“4”);   }   }   }   上述程序运行后的输出是哪项?() A、 4B、 34C、 43D、 14

考题 static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?() A、 nullB、 finallyC、 null finallyD、 Compilation fails.E、 finally exception

考题 public class Test {  public static void aMethod() throws Exception {  try {  throw new Exception(); } finally {  System.out.println(“finally”);  }  }  public static void main(String args[]) {  try {  aMethod();  } catch (Exception e) {  System.out.println(“exception”);  }  System.out.println(“finished”);  }  }  What is the result?()  A、 finallyB、 exception finishedC、 finally exception finishedD、 Compilation fails.

考题 public static void main(String[] args) {  try {  args=null;  args[0] = “test”;  System.out.println(args[0]);  } catch (Exception ex) {  System.out.println(”Exception”);  } catch (NullPointerException npe) {  System.out.println(”NullPointerException”);  }  }  What is the result?() A、 testB、 ExceptionC、 Compilation fails.D、 NullPointerException

考题 单选题public static void main(String[] args) {  try {  args=null;  args[0] = “test”;  System.out.println(args[0]);  } catch (Exception ex) {  System.out.println(”Exception”);  } catch (NullPointerException npe) {  System.out.println(”NullPointerException”);  }  }  What is the result?()A  testB  ExceptionC  Compilation fails.D  NullPointerException

考题 单选题public class Test {  public static void aMethod() throws Exception {  try {  throw new Exception(); } finally {  System.out.println(“finally”);  }  }  public static void main(String args[]) {  try {  aMethod();  } catch (Exception e) {  System.out.println(“exception”);  }  System.out.println(“finished”);  }  }  What is the result?()A  finallyB  exception finishedC  finally exception finishedD  Compilation fails.

考题 多选题public void test() {     try { oneMethod();  System.out.println("condition 1");  }  catch (ArrayIndexOutOfBoundsException e) {     System.out.println("condition 2");     }  catch(Exception e) {  System.out.println("condition 3");     }  finally {  System.out.println("finally");    }  }  Which will display if oneMethod run normally?()Acondition 1Bcondition 2Ccondition 3Dfinally

考题 单选题阅读下列程序片段: public void test(){ try{ sayHello(); System.out.println("hello"); } catch(ArrayIndexOutOfBoundException e){ System.out.println("ArrayIndexOutOfBoundException"); } catch(Exception e){ System.out.println("Exception"); } finally{ System.out.println("finally"); } }如果sayHello()方法正常运行,则test()方法的运行结果将是(  )。A helloB ArrayIndexOutOfBoundExceptionC Exception finallyD hello finally

考题 单选题如下代码:  public void Test() { try {  oneMethod();  System.out.println("condition 1");  } catch (ArrayIndexOutOfBoundsException e) {  System.out.println("condition 2");  } catch(Exception e) {  System.out.println("condition 3"); } finally {  System.out.println("finally"); }   }  如果oneMethod正常运行,则输出结果中是?()A  condition 1   finallyB  condition 2   finallyC  condition 3   finallyD  finally