publicclassTeamextendsjava.util.LinkedList{publicvoidaddPlayer(Playerp){add(p);}publicvoidcompete(Teamopponent){/*morecodehere*/}}classPlayer{/*morecodehere*/}Whichtwoaretrue?() A.Thiscodewillcompile.B.Thiscodedemonstratesproperdesignofanis-arelationship.C.Thiscodedemonstratesproperdesignofahas-arelationship.D.AJavaprogrammerusingtheTeamclasscouldremovePlayerobjectsfromaTeamobject.
publicclassTeamextendsjava.util.LinkedList{publicvoidaddPlayer(Playerp){add(p);}publicvoidcompete(Teamopponent){/*morecodehere*/}}classPlayer{/*morecodehere*/}Whichtwoaretrue?()
A.Thiscodewillcompile.
B.Thiscodedemonstratesproperdesignofanis-arelationship.
C.Thiscodedemonstratesproperdesignofahas-arelationship.
D.AJavaprogrammerusingtheTeamclasscouldremovePlayerobjectsfromaTeamobject.
相关考题:
package com.sun.sjcp;public class Commander{public static void main(String[]args){//more code here}}Assume that the class fileis located in /foo/com/sun/sjcp/,the current directory is/foo/,and that the classpath contains.(current directory).Which command line correctly runs Commander?()A.java CommanderB.java com.sim.sjcp.CommanderC.java com/sun/sjcp/CommanderD.java-cpcom.sun.sjcp CommanderE.java-cpcom/sun/sjcp Commander
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.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?()
1.publicinterfaceA{2.publicvoiddoSomething(Stringthing);3.}1.publicclassAImplimplementsA{2.publicvoiddoSomething(Stringmsg){}3.}1.publicclassB{2.publicAdoit(){3.//morecodehere4.}5.6.publicStringexecute(){7.//morecodehere8.}9.}1.publicclassCextendsB{2.publicAImpldoit(){3.//morecodehere4.}5.6.publicObjectexecute(){7.//morecodehere8.}9.}Whichstatementistrueabouttheclassesandinterfacesintheexhibit?()
classOne{voidfoo(){}}classTwoextendsOne{//insertmethodhere}Whichthreemethods,insertedindividuallyatline14,willcorrectlycompleteclassTwo?() A.intfoo(){/*morecodehere*/}B.voidfoo(){/*morecodehere*/}C.publicvoidfoo(){/*morecodehere*/}D.privatevoidfoo(){/*morecodehere*/}E.protectedvoidfoo(){/*morecodehere*/}
classFoo{11.staticvoidalpha(){/*morecodehere*/}12.voidbeta(){/*morecodehere*/}13.}Whichtwoaretrue?() A.Foo.beta()isavalidinvocationofbeta().B.Foo.alpha()isavalidinvocationofalpha().C.Methodbeta()candirectlycallmethodalpha().D.Methodalpha()candirectlycallmethodbeta().
Given:Which three methods, inserted individually at line 14, will correctly complete class Two?() A.int foo() { /* more code here */ }B.void foo() { /* more code here */ }C.public void foo() { /* more code here */ }D.private void foo() { /* more code here */ }E.protected void foo() { /* more code here */ }
Given:Which method will complete this class?() A.public int compareTo(Object o){/*more code here*/}B.public int compareTo(Score other){/*more code here*/}C.public int compare(Score s1,Score s2){/*more code here*/}D.public int compare(Object o1,Object o2){/*more code here*/}
Given:10.classOne{11.voidfoo(){}12.}13.classTwoextendsOne{14.//insertmethodhere15.}Whichthreemethods,insertedindividuallyatline14,willcorrectlycompleteclassTwo?() A.publicvoidfoo(){/*morecodehere*/}B.privatevoidfoo(){/*morecodehere*/}C.protectedvoidfoo(){/*morecodehere*/}D.intfoo(){/*morecodehere*/}E.voidfoo(){/*morecodehere*/}