11.classA{12.publicvoidprocess(){System.out.print(”A);}}13.classBextendsA{14.publicvoidprocess()throwsRuntimeException{15.super.process();16.if(true)thrownewRuntimeException();17.System.out.print(B”);}}18.publicstaticvoidmain(String[]args){19.try{((A)newB()).process();}20.catch(Exceptione){System.out.print(”Exception);}21.}Whatistheresult?()
A.Exception
B.AException
C.AExceptionB
D.ABException
E.Compilationfailsbecauseofanerrorinline14.
F.Compilationfailsbecauseofanerrorinline19.
第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.