publicclassA{2.publicStringdoit(intx,inty){3.returna”;4.}5.6.publicStringdoit(int...vals){7.returnb”;8.}9.}Given:25.Aa=newA();26.System.out.println(a.doit(4,5));Whatistheresult?() A.Line26prints“a”toSystem.out.B.Line26prints?b”toSystem.out.C.Anexceptionisthrownatline26atruntime.D.CompilationofclassAwillfailduetoanerrorinline6.
publicclassA{2.publicStringdoit(intx,inty){3.returna”;4.}5.6.publicStringdoit(int...vals){7.returnb”;8.}9.}Given:25.Aa=newA();26.System.out.println(a.doit(4,5));Whatistheresult?()
A.Line26prints“a”toSystem.out.
B.Line26prints?b”toSystem.out.
C.Anexceptionisthrownatline26atruntime.
D.CompilationofclassAwillfailduetoanerrorinline6.
相关考题:
Given:1.publicclassConstOver{2.publicconstOver(intx,inty,intz){3.}4.}WhichtwooverloadtheConstOverConstructor?() A.ConstOver(){}B.protectedintConstOver(){}C.privateConstOver(intz,inty,bytex){}D.publicObjectConstOver(Intx,inty,intz){}E.pubicvoidConstOver(bytex,bytey,bytez){}
1.classSuperFo{2.SuperFodoStuff(intx){3.returnnewSuperFo()4.}5.}6.7.classFooextendsSuperFo{8.//insertcodehere9.}和四个声明:FoodoStuff(intx){returnnewFoo();}FoodoStuff(intx){returnnewSuperFoo();}SuperFoodoStuff(intx){returnnewfoo();}SuperFoodoStuff(inty){returnnewSuperFoo();}分别插入到第8行,有几个可以通过编译()A.1B.2C.3D.4E.5
1.public classA{2.public String doit(intx,inty){3.returna;4.}5.6.public String doit(int...vals){7.returnb;8.}9.}And:25.A a=new A();26.System.out.println(a.doit(4,5));What is the result?()A.Line 26 prints a to System.out.B.Line 26 prints b to System.out.C.An exception is thrown at line 26 at runtime.D.Compilation of class A will fail due to an error in line 6.
现有:1.classSuperFoo{2.SuperFoodoStuff(intx){3.returnnewSuperFoo();4.}5.}6.7.classFooextendsSuperFoo{8.//insertcodehere9.}和四个声明:FoodoStuff(intx){returnnewFoo();}FoodoStuff(intx){returnnewSuperFoo();}SuperFoodoStuff(intx){returnnewFoo();}SuperFoodoStuff(inty){returnnewSuperFoo();}分别插入到第8行,有几个可以通过编泽?()
1.publicclassa{2.publicvoidmethod1(){3.try{4.Bb=newb();5.b.method2();6.//morecodehere7.}catch(TestExceptionte){8.thrownewRuntimeException(te);9.}10.}11.}1.publicclassb{2.publicvoidmethod2()throwsTestException{3.//morecodehere4.}5.}1.publicclassTestExceptionextendsException{2.}Given:31.publicvoidmethod(){32.Aa=newa();33.a.method1();34.}WhichistrueifaTestExceptionisthrownonline3ofclassb?()
publicclassA{2.publicvoiddoit(){3.}4.publicStringdoit(){5.returna”;6.}7.publicdoubledoit(intx){8.return1.0;9.}10.}Whatistheresult?() A.Anexceptionisthrownatruntime.B.Compilationfailsbecauseofanerrorinline7.C.Compilationfailsbecauseofanerrorinline4.D.CompilationsucceedsandnoruntimeerrorswithclassAoccur.
1.publicclassA{2.3.privateintcounter=0;4.5.publicstaticintgetInstanceCount(){6.returncounter;7.}8.9.publicA(){10.counter++;11.}12.13.}GiventhiscodefromClassB:25.Aa1=newA();26.Aa2=newA();27.Aa3=newA();28.System.out.printIn(A.getInstanceCount());Whatistheresult?()A.CompilationofclassAfails.B.Line28printsthevalue3toSystem.out.C.Line28printsthevalue1toSystem.out.D.Aruntimeerroroccurswhenline25executes.E.Compilationfailsbecauseofanerroronline28.
publicclassA{2.voidA(){3.System.out.println(ClassA”);4.}5.publicstaticvoidmain(String[]args){6.newA();7.}8.}Whatistheresult?() A.ClassAB.Compilationfails.C.Anexceptionisthrownatline2.D.Anexceptionisthrownatline6.E.Thecodeexecuteswithnooutput.
Given:Whichfivemethods,insertedindependentlyatline5,willcompile?() A.protectedintblipvert(longx){return0;}B.protectedlongblipvert(intx){return0;}C.privateintblipvert(longx){return0;}D.privateintblipvert(intx){return0;}E.publicintblipvert(intx){return0;}F.protectedlongblipvert(longx){return0;}G.protectedlongblipvert(intx,inty){return0;}