网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
classParserextendsUtils{publicstaticvoidmain(String[]args){System.out.print(newParser().getInt("42"));}intgetInt(Stringarg){returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg)throwsException{return42;}}结果为:()
A.42
B.编译失败
C.无输出结果
D.运行时异常被抛出
参考答案
更多 “ classParserextendsUtils{publicstaticvoidmain(String[]args){System.out.print(newParser().getInt(42));}intgetInt(Stringarg){returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg)throwsException{return42;}}结果为:()A.42B.编译失败C.无输出结果D.运行时异常被抛出 ” 相关考题
考题
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.编译失败
考题
现有:classParser(类)extends(继承)Utils{publicstaticvoidmain(String[]args){System.out.print(输出打印)(newParser().getInt("42"));}intgetInt(Stringarg){returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg)throwsException{return42;}}结果为:()A.42B.编译失败。C.无输出结果。D.运行时异常被抛出。
考题
现有:classParserextendsUtils{publicstaticvoidmain(String[]args){System.out.print(newParser().getInt(42));}intgetInt(Stringarg){returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg)throwsException{return42;}}结果为()A.42B.编译失败。C.无输出结果。D.运行时异常被抛出。
考题
现有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;}}结果是什么?()
考题
现有: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.编译失败
考题
现有: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.NFExcB.42C.42NFExcD.编译失败
考题
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.ABB.BCC.ABCD.BCDE.Compilationfails.
考题
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.ACB.BDC.ACDD.ABCDE.Compilationfails.
考题
以下哪个main方法是正确的?A.public static void main(string[] args)B.public static void Main(String[] args)C.public static void main(String[] args)D.public static main(String[] args)E.public void main(String[] args)
热门标签
最新试卷