单项选择题

A.foo.bar.Dogcom.foo.bar.blatz.Bookcom.bar.Carcom.bar.blatz.SunWhichgraphrepresentsthecorrectdirectorystructureforaJARfilefromwhichthoseclassescanbeusedbythecompilerandJYM?()
A.JarA
B.JarB
C.JarC
D.JarD
E.JarE
相关考题

单项选择题 Aclassgames.cards.PokeriscorrectlydefinedinthejarfilePoker.jar.AuserwantstoexecutethemainmethodofPokeronaUNIXsystemusingthecommand:javagames.cards.PokerWhatallowstheusertodothis?()

单项选择题 publicclassScoreimplementsComparable{privateintwins,losses;publicScore(intw,int1){wins=w;losses=1;}publicintgetWins(){returnwins;}publicintgetLosses(){returnlosses;}publicStringtoString(){return<+wins+,+losses+>”;}//insertcodehere}Whichmethodwillcompletethisclass?()A.publicintcompareTo(Objecto){/*modecodehere*/}B.publicintcompareTo(Scoreother){/*morecodehere*/}C.publicintcompare(Scores1,Scores2){/*morecodehere*/}D.publicintcompare(Objecto1,Objecto2){/*morecodehere*/}

单项选择题 1.publicclassTarget{2.privateinti=0;3.publicintaddOne(){4.return++i;5.}6.}And:1.publicclassClient{2.publicstaticvoidmain(String[]args){3.System.out.println(newTarget().addOne());4.}5.}WhichchangecanyoumaketoTargetwithoutaffectingClient?()A.Line4ofclassTargetcanbechangedtoreturni++;B.Line2ofclassTargetcanbechangedtoprivateinti=1;C.Line3ofclassTargetcanbechangedtoprivateintaddOne(){D.Line2ofclassTargetcanbechangedtoprivateIntegeri=0;

单项选择题 packagetest;classTarget{publicStringname=hello”;}Whatcandirectlyaccessandchangethevalueofthevariablename?()

单项选择题 voidwaitForSignal(){Objectobj=newObject();synchronized(Thread.currentThread()){obj.wait();obj.notify();}}Whichistrue?()

单项选择题 classComputationextendsThread{privateintnum;privatebooleanisComplete;privateintresult;publicComputation(intnum){this.num=num;}publicsynchronizedvoidrun(){result=num*2;isComplete=true;notify();}publicsynchronizedintgetResult(){while(!isComplete){try{wait();}catch(InterruptedExceptione){}}returnresult;}publicstaticvoidmain(String[]args){Computation[]computations=newComputation[4];for(inti=0;i<computations.length;i++){computations[i]=newComputation(i);computations[i].start();}for(Computationc:computations)System.out.print(c.getResult()+);}}Whatistheresult?()

单项选择题 fooandbararepublicreferencesavailabletomanyotherthreads.fooreferstoaThreadandbarisanObject.Thethreadfooiscurrentlyexecutingbar.wait().Fromanotherthread,whichstatementisthemostreliablewaytoensuethatfoowillstopexecutingwait()?A.foo.notify();B.bar.notify();C.foo.notifyAll();D.Thread.notify();E.bar.notiFYAll();F.Object.notify();

单项选择题 Stringtest=TestA.TestB.TestC.”;12.//insertcodehere13.String[]result=test.split(regex);Whichregularexpressioninsertedatline12willcorrectlysplittestintoTestA,”TestB,”andTestC”?()

单项选择题 System.out.format(”Piisapproximately%d.”,Math.PI);Whatistheresult?()

单项选择题 Stringtest=a1b2c3”;12.String[]tokens=test.split(”\d”);13.for(Strings:tokens)System.out.print(s+);Whatistheresult?()

单项选择题 Stringtest=Thisisatest”;12.String[]tokens=test.split(”s”);13.System.out.println(tokens.length);Whatistheresult?()

单项选择题 publicclassStarterextendsThread{privateintx=2;publicstaticvoidmain(String[]args)throwsException{newStarter().makeItSo();}publicStarter(){x=5;start();}publicvoidmakeItSo()throwsException{join();x=x-1;System.out.println(x);}publicvoidrun(){x*=2;}}Whatistheoutputifthemain()methodisrum?()A.4B.5C.8D.9E.Compilationfails.F.Anexceptionisthrownatruntime.G.Itisimpossibletodetermineforcertain.

单项选择题 publicclassTestOne{publicstaticvoidmain(String[]args)throwsException{Thread.sleep(3000);System.out.println(”sleep”);}}Whatistheresult?()

单项选择题 publicclassThreads5{publicstaticvoidmain(String[]args){newThread(newRunnable(){publicvoidrun(){System.out.print(”bar”);}}).start();}}Whatistheresult?()

单项选择题 10.publicclassSuperCaic{11.protectedstaticintmultiply(inta,intb){returna*b;}12.}and:20.publicclassSubCalcextendsSuperCalc{21.publicstaticintmultiply(inta,intb){22.intc=super.multiply(a,b);23.returnc;24.}25.}and:30.SubCalcsc=newSubCalc();31.System.out.println(sc.multiply(3,4));32.System.out.println(SubCalc.multiply(2,2));Whatistheresult?()A.124B.Thecoderunswithnooutput.C.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerrorinline21.E.Compilationfailsbecauseofanerrorinline22.F.Compilationfailsbecauseofanerrorinline31.

单项选择题 importjava.util.*;publicclassPQ{publicstaticvoidmain(String[]args){PriorityQueuepq=newPriorityQueue();pq.add(”carrot”);pq.add(”apple”);pq.add(”banana”);System.out.println(pq.poll()+”:”+pq.peek());}}Whatistheresult?()A.apple:appleB.carrot:appleC.apple:bananaD.banana:appleE.carrot:carrotF.carrot:banana

单项选择题 1.importjava.util.*;2.publicclassTestSet{3.enumExample{ONE,TWO,THREE}4.publicstaticvoidmain(String[]args){5.Collectioncoll=newArrayList();6.coll.add(Example.THREE);7.coll.add(Example.THREE);8.coll.add(Example.THREE);9.coll.add(Example.TWO);10.coll.add(Example.TWO);11.coll.add(Example.ONE);12.Setset=newHashSet(coll);13.}14.}Whichstatementistrueaboutthesetvariableonline12?()A.Thesetvariablecontainsallsixelementsfromthecollcollection,andtheorderisguaranteedtobepreserved.B.Thesetvariablecontainsonlythreeelementsfromthecollcollection,andtheorderisguaranteedtobepreserved.C.Thesetvariablecontainsallsixelementsfromthecoilcollection,buttheorderisNOTguaranteedtobepreserved.D.Thesetvariablecontainsonlythreeelementsfromthecoilcollection,buttheorderisNOTguaranteedtobepreserved.

单项选择题 1.interfaceA{publicvoidaMethod();}2.interfaceB{publicvoidbMethod();}3.interfaceCextendsA,B{publicvoidcMethod();}4.classDimplementsB{5.publicvoidbMethod(){}6.}7.classEextendsDimplementsC{8.publicvoidaMethod(){}9.publicvoidbMethod(){}10.publicvoidcMethod(){}11.}Whatistheresult?()A.Compilationfailsbecauseofanerrorinline3.B.Compilationfailsbecauseofanerrorinline7.C.Compilationfailsbecauseofanerrorinline9.D.IfyoudefineDe=newE(),thene.bMethod()invokestheversionofbMethod()definedinLine5.E.IfyoudefineDe=(D)(newE()),thene.bMethod()invokestheversionofbMethod()definedinLine5.F.IfyoudefineDe=(D)(newE()),thene.bMethod()invokestheversionofbMethod()definedinLine9.

单项选择题 11.classAnimal{publicStringnoise(){returnpeep”;}}12.classDogextendsAnimal{13.publicStringnoise(){returnbark”;}14.}15.classCatextendsAnimal{16.publicStringnoise(){returnmeow”;}17.}.....30.Animalanimal=newDog();31.Catcat=(Cat)animal;32.System.out.printIn(cat.noise());Whatistheresult?()A.peepB.barkC.meowD.Compilationfails.E.Anexceptionisthrownatruntime.

单项选择题 11.abstractclassVehicle{publicintspeed(){return0;}}12.classCarextendsVehicle{publicintspeed(){return60;}}13.classRaceCarextendsCar{publicintspeed(){return150;}}......21.RaceCarracer=newRaceCar();22.Carcar=newRaceCar();23.Vehiclevehicle=newRaceCar();24.System.out.println(racer.speed()+,?+car.speed()25.+,+vehicle.speed());Whatistheresult?()A.0,0,0B.150,60,0C.Compilationfails.D.150,150,150E.Anexceptionisthrownatruntime.