black

SCJP程序员认证考试

登录

单项选择题

static void test() throws RuntimeException { 
try { 
System.out.print(”test “); 
throw new RuntimeException(); 
} 
catch (Exception ex) { System.out.print(”exception “); } 
} 
public static void main(String[] args) { 
try { test(); } 
catch (RuntimeException ex) { System.out.print(”runtime “); } 
System.out.print(”end “); 
} 
What is the result?() 

A. test end
B. Compilation fails.
C. test runtime end
D. test exception end
E. A Throwable is thrown by main at runtime.

相关考题

单项选择题 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?()

单项选择题 static void test() throws Error {  if (true) throw new AssertionError();  System.out.print(”test “);  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  System.out.print(”elld “);  }  What is the result?()

单项选择题 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?()

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3