如果下列的方法能够正常运行,在控制台上将不显示()选项。 public void example() { try{ unsafe();     System.out.println("Test1"); }catch(SafeException e) { System.out.println("Test2"); }finally{ System.out.println("Test3"); } System.out.println("Test4"); }A.Test1B.Test2C.Test3D.Test4

如果下列的方法能够正常运行,在控制台上将不显示()选项。 public void example() { try{ unsafe();     System.out.println("Test1"); }catch(SafeException e) { System.out.println("Test2"); }finally{ System.out.println("Test3"); } System.out.println("Test4"); }

A.Test1

B.Test2

C.Test3

D.Test4


参考答案和解析
ACD

相关考题:

如下代码: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

( 15 )阅读下面程序public class Test1{public static void main(String[] args){System.out.println(34 + 56 - 6);System.out.println(26*2 - 3);System.out.println(3 * 4/2);System.out.println(5/2);}}程序运行结果是A ) 844962B ) 902562.5C ) 8423122D ) 6849142.5

请阅读下面程序 import java.io.*; public class ExceptionCatch { public static void main(String args[]) { try{ FilelnputStream fis=new FilelnputStream("text"); System.out.println("content of text is:"); } catch(FileNotFoundException e) { System.out.println(e); System.out.println("message:"+e.getMessageO); e.printStackTrace(System.out); }____{ System.out.println(e); } } } 为保证程序正确运行,程序中下划线处的语句应是A.catch(FilelnputStream fis)B.e.printStackTrace()C.catch(IOException e)D.System.out.println(e)

在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

publicclassTest{publicstaticvoidaMethod()throwsException{try{thrownewException();}finally{System.out.println(finally”);}}publicstaticvoidmain(Stringargs[]){try{aMethod();}catch(Exceptione){System.out.println(exception”);}System.out.println(finished”);}}Whatistheresult?()A.finallyB.exceptionfinishedC.finallyexceptionfinishedD.Compilationfails.

在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

下面程序输出的结果是什么? ( ) 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.无输出

如下的代码段中,如果方法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 Z { public static void main(String args[]) { new Z(); } Z() { Z aliasl=this; Z alias2=this; synchronized(aliasl) { try{ alias2.walt(); System.out.println("DONE WAITING"); } catch(InterruptedException e) { System.out.println("INTERR UPTED"); } catch (Exception e) { System.out.println("OTHER EXCEPTION"); } finally{ System.out.println("FINALLY"); } } System.out.println("ALL DONE"); } }A.应用程序编译正常,但是不打印任何数据B.应用程序编译正常,并打印数据“DONE WAITING”C.应用程序编译正常,并打印数据“FINALLY”D.应用程序编译正常,并打印数据“ALL DONE”

在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

下面程序输出的结果是什么? ( ) 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 MyExeeption extends Exception{}A.It's finally caught!B.It's caught!C.It's caught!/It'sfinally caught!D.无输出

分析下列代码:  Class A{  Public static void main(String[] args){  method(); }  static void method(){  try{  System.out.println("Hello"); }finally{  System.out.println("good-bye"); } } }  编译运行后,输出结果是()。 A、"Hello"B、"good-bye"C、"Hello""god-bye"D、代码不能编译

如下代码:  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

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 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.

在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件: import java.io.*;  public class Mine {  public static void main(String argv[]){      Mine m=new Mine();  System.out.println(m.amethod());   }  public int amethod() {     try {  FileInputStream dis=new FileInputStream("Hello.txt");  }  catch (FileNotFoundException fne) {  System.out.println("No such file found");          return -1;     }  catch(IOException ioe)  { }     finally {  System.out.println("Doing finally");     }  return 0;   } }  结果会输出()。 A、No such file foundB、No such file found -1C、No such file found doing finally -1D、0

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.

单选题分析下列代码:  Class A{  Public static void main(String[] args){  method(); }  static void method(){  try{  System.out.println("Hello"); }finally{  System.out.println("good-bye"); } } }  编译运行后,输出结果是()。AHelloBgood-byeCHellogod-byeD代码不能编译

单选题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

单选题在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件: import java.io.*;  public class Mine {  public static void main(String argv[]){      Mine m=new Mine();  System.out.println(m.amethod());   }  public int amethod() {     try {  FileInputStream dis=new FileInputStream("Hello.txt");  }  catch (FileNotFoundException fne) {  System.out.println("No such file found");          return -1;     }  catch(IOException ioe)  { }     finally {  System.out.println("Doing finally");     }  return 0;   } }  结果会输出()。ANo such file foundBNo such file found -1CNo such file found doing finally -1D0

多选题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 {  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

单选题阅读下列程序片段: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()方法的运行结果将是(  )。AhelloBArrayIndexOutOfBoundExceptionCException finallyDhello finally