网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
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.finally
B.exceptionfinished
C.finallyexceptionfinished
D.Compilationfails.
参考答案
更多 “ 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. ” 相关考题
考题
在C#程序中,下列用来处理异常的结构,错误的是()。A、try{}catch{}finally{}B、try{}finally{}C、ch{}finally{}D、try{}catch{}
考题
classBirds{publicstaticvoidmain(String[]args){try{thrownewException();}catch(Exceptione){try{thrownewException();}catch(Exceptione2){System.out.print(inner);}System.out.print(middle);}System.out.print(outer);}}结果为:()A.innerB.innerouterC.middleouterD.innermiddleouter
考题
现有:voidtopGo(){try{middleGo();}catch(Exceptione){System.out.print(catch);}}voidmiddleGo()throwsException{go();system.out.print(latemiddle);}voidgo()throwsExceptiOn{thrownewException();}如果调用topGo(),则结果为:()A.latemiddleB.catchC.latemiddlecatchD.catchIatemiddle
考题
1.publicclasstest{2.publicstaticstringoutput=”3.4.publicstaticvoidfoo(inti){5.try{6.if(i==1){7.thrownewException();8.}9.output+=1”;10.}11.catch(Exceptione){12.output+=2”;13.return;14.}15.finally(16.output+=3”;17.)18.output+=4”;19.}20.21.publicstaticvoidmain(stringargs[])(22.foo(0);23.foo(1);24.25.)26.}Whatisthevalueofthevariableoutputatline24?()
考题
1.publicclassTest{2.publicstaticStringoutput=””;3.4.publicstaticvoidfoo(inti){5.try{6.if(i==1){7.thrownewException();8.}9.output+=“1”;10.}11.catch(Exceptione){12.output+=“2”;13.return;14.}15.finally{16.output+=“3”;17.}18.output+=“4”;19.}20.21.publicstaticvoidmain(Stringargs[]){22.foo(0);23.foo(1);24.25.}26.}Whatisthevalueofthevariableoutputatline23?()
考题
给定以下JAVA代码,这段代码编译运行后输出的结果是( )publicclassTest{publicstaticintaMethod(inti)throwsException{try{returni/10;}catch(Exceptionex){thrownewException("exceptioninaaMothod");}finally{System.out.print("finally");}}publicstaticvoidmain(String[]args){try{aMethod(0);}catch(Exceptionex){System.out.print("exceptioninmain");}System.out.print("finished");}}A、finallyexceptioninmainfinishedB、exceptioninmainfinallyC、finallyfinishedD、finallyexceptioninmainfinished
考题
4、以下异常处理结构中,错误的是()A.catch{} finally{}B.try{} finally{}C.try{} catch{} finally{}D.try{} catch{}
考题
以下异常处理结构中,错误的是()A.catch{} finally{}B.try{} finally{}C.try{} catch{} finally{}D.try{} catch{}
考题
给定如下Java代码片段,则下列调用方法正确的是()。 Public int count (int i) throws Exception { if (i==0) throw new Exception(“参数不正确!”); return 20/i; }A.public void useCount(){ count(0); }B.public void useCount() throws Exception{ count(0); }C.public void useCount(){ try { count(10); }catch(ArithmeticException e){} }D.public void useCount(){ try{ count(10); } }
热门标签
最新试卷