classsuper{2.publicfloatgetNum(){return3.0f;}3.}4.5.publicclassSubextendsSuper{6.7.}Whichmethod,placedatline6,willcauseacompilererror?() A.PublicfloatgetNum(){return4.0f;}B.PublicvoidgetNum(){}C.PublicvoidgetNum(doubled){}D.PublicdoublegetNum(floatd){retrun4.0f;}

classsuper{2.publicfloatgetNum(){return3.0f;}3.}4.5.publicclassSubextendsSuper{6.7.}Whichmethod,placedatline6,willcauseacompilererror?()

A.PublicfloatgetNum(){return4.0f;}

B.PublicvoidgetNum(){}

C.PublicvoidgetNum(doubled){}

D.PublicdoublegetNum(floatd){retrun4.0f;}


相关考题:

classsuper{publicintgetLength(){return4;}}publicclassSubextendsSuper{publiclonggetLength(){return5;}publicstaticvoidmain(String[]args){supersooper=newSuper();Subsub=newSub();System.out.printIn(sooper.getLength()+,”+sub.getLength()};}Whatistheoutput?()A.4,4B.4,5C.5,4D.5,5E.Thecodewillnotcompile.

classsuper(publicintI=0;publicsuper(stringtext)(I=1))publicclasssubextendssuper(publicsub(stringtext)(i=2)publicstaticvoidmain(straingargs[])(subsub=newsub(Hello”);system.out.PrintIn(sub.i);))Whatistheresult?()A.Compilationwillfail.B.Compilationwillsucceedandtheprogramwillprint“0”C.Compilationwillsucceedandtheprogramwillprint“1”D.Compilationwillsucceedandtheprogramwillprint“2”

classSuper{publicinti=0;publicSuper(Stringtext){i=1;}}publicclassSubextendsSuper{publicSub(Stringtext){i=2;}publicstaticvoidmain(Stringargs[]){Subsub=newSub(Hello”);System.out.println(sub.i);}}Whatistheresult?()A.0B.1C.2D.Compilationfails.

classSuper{publicintgetLenght(){return4;}}publicclassSubextendsSuper{publiclonggetLenght(){return5;}publicstaticvoidmain(String[]args){Supersooper=newSuper();Subsub=newSub();System.out.println(sooper.getLenght()+“,”+sub.getLenght());}}Whatistheoutput?()A.4,4B.4,5C.5,4D.5,5E.Compilationfails.

classSuper{publicIntegergetLenght(){returnnewInteger(4);}}publicclassSubextendsSuper{publicLongGetLenght(){returnnewLong(5);}publicstaticvoidmain(String[]args){Supersooper=newSuper();Subsub=newSub();System.out.println(sooper.getLenght().toString()+,”+sub.getLenght().toString());}}Whatistheoutput?()A.4,4B.4,5C.5,4D.5,5E.Compilationfails.

classSuper{2.publicfloatgetNum(){return3.0f;}3.}4.5.publicclassSubextendsSuper{6.7.}Whichmethod,placedatline6,causescompilationtofail?() A.publicvoidgetNum(){}B.publicvoidgetNum(doubled){}C.publicfloatgetNum(){return4.0f;}D.publicdoublegetNum(floatd){return4.0d;}

classsuper{publicfloatgetNum(){return3.0f;}}publicclassSubextendsSuper{}Whichmethod,placedatline6,willcauseacompilererror?() A.PublicfloatgetNum(){return4.0f;}B.PublicvoidgetNum(){}C.PublicvoidgetNum(doubled){}D.PublicdoublegetNum(floatd){retrun4.0f;}

将下列哪个代码(A,B,C,D)放入程序中标注的【代码】处将导致编译错误? class A { public float getNum() { return 3.0f; } } public class B extends A { 【代码】 }A.public float getNum(){return 4.0f;}B.public void getNum(){ }C.public void getNum(double d){ }D.public double getNum(float d){return 4.0d;}

将以下哪种方法插入到第6行是不合法的() 。 1.public class Test1 { 2. public float aMethod(float a,float b) throws 3. IOException { } 4. } 5.public class Test2 extends Test1{ 6. 7.}A.float aMethod(float a,float b){ }B.public int aMethod(int a,int b)throws Exception{ }C.public float aMethod(float p,float q){ }D.public int aMethod(int a,int b)throws IOException{ }