나는이 테스트를 통해 자바 책에서이 프로그램을 보았는데 나는 이것이 정답 인 이유를 이해할 수 없다.자바 테스트 (초보자)
프로그램의 출력은 어떻게 될 것인가?
class Base
{
Base()
{
System.out.print("Base");
}
}
public class Alpha extends Base
{
public static void main(String[] args)
{
new Alpha(); /* Line 12 */
new Base(); /* Line 13 */
}
}
모든 답변 :
- A.Base
- B.BaseBase
- C.Compilation는
- D.The 코드는 더 출력
으로 실행 실패 정답은 BaseBase
입니다.
[관련] (http://stackoverflow.com/questions/10508107/why-call-super-in-a-constructor) – Scis