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.42
B.NFExc
C.42NFExc
D.编译失败
第1题:
现有: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.编译失败
第2题:
现有: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.innerouter
B.middleouter
C.innermiddleouter
D..编译失败
第3题:
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.null
B.finally
C.nullfinally
D.Compilationfails.
E.finallyexception
第4题:
现有:classParserextendsUtilis{publicstaticvoidmain(String[]args){try{System.out.print(newParser().getlnt("42")};}catch(NumberFormatExceptionn){System.out.println("NFExc");}}intgetlnt(Stringarg)throwsNumberFormatException{returnInteger.parselnt(arg);}classUtils{intgetlnt(Stringarg){return42;}}结果为:()
A.NFExc
B.42
C.42NFExc
D.编译失败
第5题:
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.testend
B.Compilationfails.
C.testruntimeend
D.testexceptionend
E.AThrowableisthrownbymainatruntime.