网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
classA{publicA(){System.out.println(hellofroma”);}}classBextendsA{publicB(){System.out.println(hellofromb”);super();}}publicclassTest{publicstaticvoidmain(Stringargs[]){Aa=newB();}}Whatistheresultwhenmainisexecuted?()
A.Compilationfails.
B.hellofroma
C.hellofromb
D.hellofrombhellofroma
E.hellofromahellofromb
参考答案
更多 “ 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 ” 相关考题
考题
给定如下Java程序片断:classA{publicA(){System.out.println(A);}}classBextendsA{publicB(){System.out.println(B);}publicstaticvoidmain(String[]args){Bb=newB();}}上述程序将()。
A.不能通过编译B.通过编译,输出为:ABC.通过编译,输出为:BD.通过编译,输出为: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 { }
考题
下面程序的结果是includeclass A{public: A(){cout
下面程序的结果是 #include<iostream.h> class A { public: A(){cout<<"construtA" <<endl;} virtual ~A() {cout << "destructA" <<endl;}}; class B:public A { }; class C:public A { }; class D:public B,public C { }; void main() { Dd;}A.constructAB.constructAC.constmctAD.constmctA destructA constructA constmctA constructA destructA constructA constructA destructA destructA constructA destructA dest
考题
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.
考题
Whatproducesacompilererror?()
A.classA{publicA(intx){}}B.classA{}classBextendsA{B(){}}C.classA{A(){}}classB{publicB(){}}D.classZ{publicZ(int){}}classAextendsZ{}
考题
InwhichtwocasesdoesthecompilersupplyadefaultconstructorforclassA?()
A.classA{}B.classA{publicA(){}}C.classA{publicA(intx){}}D.classZ{}classAextendsZ{voidA(){}}
考题
给出下列的代码,则下列选项中哪个是类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{ }
考题
23、假定类A已经定义,对于以A为基类的单一继承类B,以下定义中正确的是:()A.class B:public A{//...};B.class A:public B{//...};C.class B:public class A{//...};D.class A:class B public{//...};
热门标签
最新试卷