现有:classParserextendsUtils{publicstaticvoidmain(String[]args){try{System.out.print(newParser().getlnt(42));}catch(Exceptione){System.out.println(Exc);}}intgetlnt(Stringarg)throwsException{returnInteger.parselnt(arg);}classUtils{intgetlnt(Stringarg){return42;}}结果为()A.42B.ExcC.42ExcD.编译失败

现有:classParserextendsUtils{publicstaticvoidmain(String[]args){try{System.out.print(newParser().getlnt("42"));}catch(Exceptione){System.out.println("Exc");}}intgetlnt(Stringarg)throwsException{returnInteger.parselnt(arg);}classUtils{intgetlnt(Stringarg){return42;}}结果为()

A.42

B.Exc

C.42Exc

D.编译失败


相关考题:

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

classParserextendsUtils{publicstaticvoidmain(String[]args){try{System.out.print(newParser().getInt(42));}catch(NumberFormatExceptionn){System.out.println(NFExc);}}intgetInt(Stringarg)throwsNumberFormatException{returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg){return42;}}结果为:()A.42B.NFExcC.42NFExcD.编译失败

现有:classParserextendsUtils{publicstaticvoidmain(String[]args){System.out.print(newParser().getInt(42));}intgetInt(Stringarg){returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg)throwsException{return42;}}结果为()A.42B.编译失败。C.无输出结果。D.运行时异常被抛出。

现有:classWaitingimplementsRunnable{booleanflag=false;publicsynchronizedvoidrun(){if(flag){flag=false;System.out.print(1);try{this.wait();)catch(Exceptione){}System.out.print(2);}else{flag=true;System.out.print(3);try{Thread.sleep(2000);}catch(Exceptione){}System.out.print(4);notify();}}publicstaticvoidmain(String[]args){Waitingw=newWaiting();newThread(w).start();newThread(w).start();}}以下哪两项是正确的?()

现有classParserextendsUtils{publicstaticvoidmain(String[]args){try{System.out.print(newParser().getlnt("42"))}catch(Exceptione){System.out.println("Exc");}}intgetlnt(Stringarg)throwsException{returnInteger.parselnt(arg);}}classUtils{intgetlnt(){return42;}}结果是什么?()

现有: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.innerouterB.middleouterC.innermiddleouterD..编译失败

现有:classFlow{publicstaticvoidmain(String[]args)try{System.out.print(before);doRiskyThing();System.out.print(after);}catch(Exceptionfe){System.out.print(catch);}System.out.println(done);}publicstaticvoiddoRiskyThing()throwsException{//thiscodereturnsunlessitthrowsanException}}可能会产生哪两项结果?()A.beforecatchB.beforeafterdoneC.beforecatchdoneD.beforeaftercatch

staticvoidtest()throwsRuntimeException{try{System.out.print(”test);thrownewRuntimeException();}catch(Exceptionex){System.out.print(”exception);}}publicstaticvoidmain(String[]args){try{test();}catch(RuntimeExceptionex){System.out.print(”runtime);}System.out.print(”end);}Whatistheresult?()A.testendB.Compilationfails.C.testruntimeendD.testexceptionendE.AThrowableisthrownbymainatruntime.

staticvoidtest(){try{Stringx=null;System.out.print(x.toString()+);}finally{System.out.print(finally);}}publicstaticvoidmain(String[]args){try{test();}catch(Exceptionex){System.out.print(”exception);}}Whatistheresult?()A.nullB.finallyC.nullfinallyD.Compilationfails.E.finallyexception