black

SCJP程序员认证考试

登录

单项选择题

class ClassA { 
public int numberOfinstances; 
protected ClassA(int numberOfinstances) { 
this.numberOflnstances = numberOfinstances; 
} 
} 
public class ExtendedA extends ClassA { 
private ExtendedA(int numberOfinstances) { 
super(numberOflnstances); 
} 
public static void main(String[] args) { 
ExtendedA ext = new ExtendedA(420); 
System.out.print(ext.numberOflnstances); 
} 
} 
Which is true?() 

A. 420 is the output.
B. An exception is thrown at runtime.
C. All constructors must be declared public.
D. Constructors CANNOT use the private modifier.
E. Constructors CANNOT use the protected modifier.

相关考题

多项选择题 interface A { public int getValue() }  class B implements A {  public int getValue() { return 1; }  }  class C extends B {  // insert code here  }  Which three code fragments, inserted individually at line 15, make use of polymorphism?()

单项选择题 1. interface A { public void aMethod(); }  2. interface B { public void bMethod(); }  3. interface C extends A,B { public void cMethod(); }  4. class D implements B {  5. public void bMethod() { }  6. }  7. class E extends D implements C {  8. public void aMethod() { }  9. public void bMethod() { }  10. public void cMethod() { }  11. }  What is the result?()

单项选择题 1. class SuperClass {  2. public a geta() {  3. return new a();  4. }  5. }  6. class SubClass extends SuperClass {  7. public b geta() {  8. return new b();  9. }  10. }  Which is true?()

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3