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{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


相关考题:

给定如下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{//...};