单项选择题
A. null
B. finally
C. null finally
D. Compilation fails.
E. finally exception
单项选择题 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?()
单项选择题 1.publicclassa{ 2.publicvoidmethod1(){ 3.try{ 4.Bb=newb(); 5.b.method2(); 6.//morecodehere 7.}catch(TestExceptionte){ 8.thrownewRuntimeException(te); 9.} 10.} 11.} 1.publicclassb{ 2.publicvoidmethod2()throwsTestException{ 3.//morecodehere 4.} 5.} 1.publicclassTestExceptionextendsException{ 2.} Given: 31.publicvoidmethod(){ 32.Aa=newa(); 33.a.method1(); 34.} WhichistrueifaTestExceptionisthrownonline3ofclassb?()