网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

现有:classParser(类)extends(继承)Utils{publicstaticvoidmain(String[]args){System.out.print(输出打印)(newParser().getInt("42"));}intgetInt(Stringarg){returnInteger.parseInt(arg);}}classUtils{intgetInt(Stringarg)throwsException{return42;}}结果为:()

A.42

B.编译失败。

C.无输出结果。

D.运行时异常被抛出。


参考答案

更多 “ 现有: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.运行时异常被抛出。 ” 相关考题
考题 现有:classCat{Cat(intc){System.out.print(cat+c+);}}classSubCatextendsCat{SubCat(intc){super(5);System.out.print(cable);}SubCat(){this(4);}publicstaticvoidmain(String[]args){SubCats=newSubCat();}}结果为:()A.cat5B.cableC.cablecat5D.cat5cable

考题 现有: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

考题 现有:classBird{voidtalk(){System.out.print(chirp);}}classParrot2extendsBird{protectedvoidtalk(){System.out.print(hello);publicstaticvoidmain(String[]args){Bird[]birds={newBird(),newParrot2()};for(Birdb:birds)b.talk();}}结果是什么?()A.chirpchirpB.hellohelloC.chirphelloD.编译错误

考题 现有classBeverage{Beverage(){System.out.print(beverage);}}classBeerextendsBeverage{publicstaticvoidmain{string[]args){Beerb=newBeer(14);}publicintBeer(intx){this();System.out.print(beerl);}publicBeer(){System.out.print(beer2);}}结果是什么?()A.beerlbeverageB.beer2beverageC.beveragebeer2beerlD.编译失败

考题 现有:classCat{Cat(intc){System.out.print{cat+c+);}}classSubCatextendsCat{SubCat(intc){super(5);System.out.print(cable);}SubCat(){this(4);}publicstaticvoidmain(String[]args){SubCats=newSubCat();}}结果为:()A.cat5B.cableC.cat5cableD.cablecat5

考题 现有:classOutput{publicstaticvoidmain(String[]args){inti=5:System.out.print(4+i+);System.out.print(i+5+7);System.out.println(i+8);}}结果为:() A.99722B.955758C.4510758D.459722

考题 现有:classTestApp{publicstaticvoidmain(String[]args){for(inti=0;iif(i==3)break;System.out.print(i);}}}程序运行后的输出是哪项?() A.0123B.012456789C.0123456789D.012

考题 现有:classPasserfstaticfinalintX=5;publicstaticvoidmain(String[]args){newPasser().go(x);System.out.print(x);}voidgo(intx){System.out.print(x++);}结果是什么?() A.55B.56C.65D.66