多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

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.
正确答案:A
答案解析:
进入题库查看解析

微信扫一扫手机做题