11.classa{12.publicvoidprocess(){System.out.print(”a,”);}}13.classbextendsa{14.publicvoidprocess()throwsIOException{15.super.process();16.System.out.print(”b,”);17.thrownewIOException();18.}}19.publicstaticvoidmain(String[]args){20.try{newb().process();}21.catch(IOExceptione){System.out.println(”Exception”);}}Whatistheresult?()
A.Exception
B.a,b,Exception
C.Compilationfailsbecauseofanerrorinline20.
D.Compilationfailsbecauseofanerrorinline14.
E.ANullPointerExceptionisthrownatruntime.
第1题:
publicclassX{publicstaticvoidmain(String[]args){try{badMethod();System.out.print(A”);}catch(Exceptionex){System.out.print(C”);}finally{System.out.print(B”);}System.out.print(D”);}publicstaticvoidbadMethod(){thrownewError();}}Whatistheresult?()
A.ABCD
B.Compilationfails.
C.Cisprintedbeforeexitingwithanerrormessage.
D.BCisprintedbeforeexitingwithanerrormessage.
E.BCDisprintedbeforeexitingwithanerrormessage.
第2题:
publicclassX{publicstaticvoidmain(String[]args){try{badMethod();System.out.print(A”);}catch(Exceptionex){System.out.print(B”);}finally{System.out.print(C”);}System.out.print(D”);}publicstaticvoidbadMethod(){thrownewRuntimeException();}}Whatistheresult?()
A.AB
B.BC
C.ABC
D.BCD
E.Compilationfails.
第3题:
下面能表示一个正确的类的是( )。
A.class A
B.class A()
C.class A[]
D.class A{}
第4题:
publicclassX{publicstaticvoidmain(String[]args){try{badMethod();System.out.print(A”);}catch(RuntimeExceptionex){System.out.print(B”);}catch(Exceptionex1){System.out.print(C”);}finally{System.out.print(D”);}System.out.print(E”);}publicstaticvoidbadMethod(){thrownewRuntimeException();}}Whatistheresult?()
A.BD
B.BCD
C.BDE
D.BCDE
E.ABCDE
F.Compilationfails.
第5题:
publicclassX{publicstaticvoidmain(String[]args){try{badMethod();System.out.print(A”);}catch(Exceptionex){System.out.print(B”);}finally{System.out.print(C”);}System.out.print(D”);}publicstaticvoidbadMethod(){}}Whatistheresult?()
A.AC
B.BD
C.ACD
D.ABCD
E.Compilationfails.