多选题 What constructor is equivalent to the one listed here?
public SampleConstructor( {
System.out.println("SampleConstructor");
}
  • A. public SampleConstructor() { this(); System.out.println("Sample Constructor"); }
  • B. public SampleConstructor() { super(); System.out.println("Sample Constructor"); }
  • C. public SampleConstructor() { this.SampleConstructor(); System.out.println("Sample Constructor"); }
  • D. public SampleConstructor() { super.SampleConstructor(); System.out.println("Sample Constructor"); }
  • E. None of the above
【正确答案】 B
【答案解析】如果不在构造函数的第一行调用super,编译器将会自动添加它。A、C、D和E不正确。A不正确,因为this()调用当前类的构造函数。C和D不是super或this的正确用法。