A.ClassB’sconstructorispublic.
B.ClassB’sconstructorhasnoarguments.
C.ClassB’sconstructorincludesacalltothis().
D.ClassB’sconstructorincludesacalltosuper().
第1题:
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
第2题:
A.classA{publicA(intx){}}
B.classA{}classBextendsA{B(){}}
C.classA{A(){}}classB{publicB(){}}
D.classZ{publicZ(int){}}classAextendsZ{}
第3题:
给出—卜列的代码,则下列选项中( )可以表示为类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{ }
第4题:
A.1
B.2
C.Anexceptionisthrownatruntime.
D.Compilationfailsbecauseofanerrorinline8.
E.Compilationfailsbecauseofanerrorinline14.
第5题:
给出下列的代码,则下列选项中哪个是类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 { }