网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

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

A.4,4

B.4,5

C.5,4

D.5,5

E.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. ” 相关考题
考题 1.classOver{2.intdoIt(longx){return3;}3.}4.5.classUnderextendsOver{6.//insertcodehere7.}和四个方法:shortdoIt(inty){return4;}intdoIt(longx,longy){return4;}privateintdoIt(Shorty){return4;}protectedintdoIt(longx){return4;}分别插入到第6行,有几个可以通过编译?()A.2B.3C.4D.0E.1

考题 现有:1.classOver{2.intdolt(longx){return3;}3.}4.5.classUnderextendsOver{6.//insertcodehere7.}和四个方法:shortdolt(inty){return4;}intdolt(longXrlongy){return4;}privateintdolt(shorty){return4;}protectedintdolt(longx){return4;}分别插入到第6行,有几个可以通过编译?()A.1B.2C.3D.4

考题 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{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{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{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;}