网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
classA{A(){}}classBextendsA{}Whichtwostatementsaretrue?()
A.ClassB’sconstructorispublic.
B.ClassB’sconstructorhasnoarguments.
C.ClassB’sconstructorincludesacalltothis().
D.ClassB’sconstructorincludesacalltosuper().
参考答案
更多 “ classA{A(){}}classBextendsA{}Whichtwostatementsaretrue?() A.ClassB’sconstructorispublic.B.ClassB’sconstructorhasnoarguments.C.ClassB’sconstructorincludesacalltothis().D.ClassB’sconstructorincludesacalltosuper(). ” 相关考题
考题
给出下列代码,可放在类A的横线位置作为A合理的内部类的是( )。 class A { protected int i; A(int i) { this.i = i; } ______ }A.class B { }B.class B extends A { }C.class B implements A { }D.class A { }
考题
给出下列的程序段,则哪个选项是类A合理的内部类? ( ) class A{ protected int i; A(int i){ this.i=i;A.classB { }B.class B extendsA { }C.class B extends A{ B(){System.out.println("i="+1);} }D.class A { }
考题
现有:classA{publicStringname=a}classBextendsA{publicStringname=b}执行如下代码后的结果是哪项?()Aa=newB();System.out.println(a.name);
A.aB.bC.编译失败D.运行时抛出异常
考题
Whichstatementsconcerningthefollowingcodearetrue?()classa{publica(){}publica(inti){this();}}classbextendsa{publicbooleanb(Stringmsg){returnfalse;}}classcextendsb{privatec(){super();}publicc(Stringmsg){this();}publicc(inti){}}A.Thecodewillfailtocompile.B.Theconstructorinathattakesanintasanargumentwillneverbecalledasaresultofconstructingan objectofclassborc.C.Classchasthreeconstructors.D.Objectsofclassbcannotbeconstructed.E.Atmostoneoftheconstructorsofeachclassiscalledasaresultofconstructinganobjectofclassc.
考题
classA{publicA(){System.out.println(hellofroma”);}}classBextendsA{publicB(){System.out.println(hellofromb”);super();}}publicclassTest{publicstaticvoidmain(Stringargs[]){Aa=newB();}}Whatistheresultwhenmainisexecuted?()A.Compilationfails.B.hellofromaC.hellofrombD.hellofrombhellofromaE.hellofromahellofromb
考题
classA{publicbytegetNumber(){return1;}}classBextendsA{publicshortgetNumber(){return2;}publicstaticvoidmain(Stringargs[]){Bb=newB();System.out.println(b.getNumber());}}Whatistheresult?()
A.1B.2C.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerrorinline8.E.Compilationfailsbecauseofanerrorinline14.
考题
Whatproducesacompilererror?()
A.classA{publicA(intx){}}B.classA{}classBextendsA{B(){}}C.classA{A(){}}classB{publicB(){}}D.classZ{publicZ(int){}}classAextendsZ{}
考题
给出下列的代码,则下列选项中哪个是类A合理的内部类? class A { protected int i; A(int i) { this.i=i; } }A.class B { }B.class B extends A { }C.class B extends A { B( ){System.out.println("="+i);} }D.class A { }
考题
给出—卜列的代码,则下列选项中( )可以表示为类A合理的内部类。 class A{ protected int i; A (int i) { this i=i; }}A.class B{ }B.class B extends A{ }C.class B extends A{ B ( ){System.out.println("i="+i);} }D.class A{ }
热门标签
最新试卷