单项选择题

A.importjava.io.*;
B.publicclassFooimplementsSerializable{
C.publicintx,y;
D.publicFoo(intx,inty){this.x=x;this.y=y;}
E.
F.privatevoidwriteObject(ObjectOutputStreams)
G.throwsIOException{
H.s.writeInt(x);s.writeInt(y)
I.}
J.
K.privatevoidreadObject(ObjectInputStreams)
L.throwsIOException,ClassNotFoundException{
M.
N.//insertcodehere
O.
P.}
Q.}
相关考题

单项选择题 AssumingthattheserializeBanana2()andthedeserializeBanana2()methodswillcorrectlyuseJavaserializationandgiven:importjava.io.*;classFood{Food(){System.out.print(”1”);}}classFruitextendsFoodimplementsSerializable{Fruit(){System.out.print(”2”);}}publicclassBanana2extendsFruit{intsize=42;publicstaticvoidmain(String[]args){Banana2b=newBanana2();b.serializeBanana2(b);//assumecorrectserializationb=b.deserializeBanana2(b);//assumecorrectSystem.out.println(”restored+b.size+);}//moreBanana2methods}Whatistheresult?()

单项选择题 10.publicclassFooimplementsjava.io.Serializable{11.privateintx;12.publicintgetX(){returnx;}12.publicFoo(intx){this.x=x;}13.privatevoidwriteObject(ObjectOutputStreams)14.throwsIOException{15.//insertcodehere16.}17.}Whichcodefragment,insertedatline15,willallowFooobjectstobecorrectlyserializedanddeserialized?()A.s.writeInt(x);B.s.serialize(x);C.s.writeObject(x);D.s.defaultWriteObject();

判断题 通信管道与通道的建设应较相关市政地下管线之前进行建设。()

单项选择题 publicvoidsomeMethod(Objectvalue){12.//checkfornullvalue....20.System.out.println(value.getClass());21.}What,insertedatline12,istheappropriatewaytohandleanullvalue?()

单项选择题 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.

单项选择题 11.staticclassA{12.voidprocess()throwsException{thrownewException();}13.}14.staticclassBextendsA{15.voidprocess(){System.out.println(”B”);}16.}17.publicstaticvoidmain(String[]args){18.newB().process();19.}Whatistheresult?()A.BB.Thecoderunswithnooutput.C.Compilationfailsbecauseofanerrorinline12.D.Compilationfailsbecauseofanerrorinline15.E.Compilationfailsbecauseofanerrorinline18.

单项选择题 staticvoidtest()throwsError{if(true)thrownewAssertionError();System.out.print(”test);}publicstaticvoidmain(String[]args){try{test();}catch(Exceptionex){System.out.print(”exception);}System.out.print(”elld);}Whatistheresult?()A.endB.Compilationfails.C.exceptionendD.exceptiontestendE.AThrowableisthrownbymain.F.AnExceptionisthrownbymain.

单项选择题 84.try{85.ResourceConnectioncon=resourceFactory.getConnection();86.Resultsr=con.query(”GETINFOFROMCUSTOMER”);87.info=r.getData();88.con.close();89.}catch(ResourceExceptionre){90.errorLog.write(re.getMessage());91.}92.returninfo;WhichistrueifaResourceExceptionisthrownonline86?()A.Line92willnotexecute.B.Theconnectionwillnotberetrievedinline85.C.Theresourceconnectionwillnotbeclosedonline88.D.Theenclosingmethodwillthrowanexceptiontoitscaller.

单项选择题 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?()

单项选择题 publicstaticvoidmain(String[]args){try{args=null;args[0]=test”;System.out.println(args[0]);}catch(Exceptionex){System.out.println(”Exception”);}catch(NullPointerExceptionnpe){System.out.println(”NullPointerException”);}}Whatistheresult?()A.testB.ExceptionC.Compilationfails.D.NullPointerException

单项选择题 Giventhismethodinaclass:publicStringtoString(){StringBufferbuffer=newStringBuffer();buffer.append(?<?);buffer.append(this.name);buffer.append(?>?);returnbuffer.toString();}Whichistrue?()

单项选择题 publicclassFoo{staticint[]a;static{a[0]=2;}publicstaticvoidmain(String[]args){}}Whichexceptionorerrorwillbethrownwhenaprogrammerattemptstorunthiscode?()

单项选择题 10.publicclassClassA{11.publicvoidmethodA(){12.ClassBclassB=newClassB();13.classB.getValue();14.}15.}And:20.classClassB{21.publicClassCclassC;22.23.publicStringgetValue(){24.returnclassC.getValue();25.}26.}And:30.classClassC{31.publicStringvalue;32.33.publicStringgetValue(){34.value=ClassB”;35.returnvalue;36.}37.}Given:ClassAa=newClassA();a.methodA();Whatistheresult?()

单项选择题 publicclassTestString1{publicstaticvoidmain(String[]args){Stringstr=420”;str+=42;System.out.print(str);}}Whatistheoutput?()

单项选择题 Whatwillbewrittentothestandardoutputwhenthefollowingprogramisrun?()publicclassQ03e4{publicstaticvoidmain(Stringargs[]){Stringspace="";Stringcomposite=space+"hello"+space+space;composite.concat("world");Stringtrimmed=composite.trim();System.out.println(trimmed.length());}}A.5B.6C.7D.12E.13

未知题型 如何处理单元测试产生的数据,下列哪些说法是正确的?

单项选择题 1.publicclassGoTest{2.publicstaticvoidmain(String[]args){3.Sentea=newSente();a.go();4.Gobanb=newGoban();b.go();5.Stonec=newStone();c.go();6.}7.}8.9.classSenteimplementsGo{10.publicvoidgo(){System.out.println(”goinSente.”);}11.}12.13.classGobanextendsSente{14.publicvoidgo(){System.out.println(”goinGoban”);}15.}16.17.classStoneextendsGobanimplementsGo{}18.19.interfaceGo{publicvoidgo();}Whatistheresult?()

单项选择题 publicabstractclassShape{intx;inty;publicabstractvoiddraw();publicvoidsetAnchor(intx,inty){this.x=x;this.y=y;}}andaclassCirclethatextendsandfullyimplementstheShapeclass.Whichiscorrect?()

单项选择题 interfaceData{publicvoidload();}abstractclassInfo{publicabstractvoidload();}WhichclasscorrectlyusestheDatainterfaceandInfoclass?()

判断题 Flash中的图层分为普通层、运动引导层、遮罩层和注释说明层4种。通常建立的层都是普通层。()