``` public class LaoTzu extends Philosopher { public static void main(String[] args) { new LaoTzu(); new LaoTzu("Tigger"); } LaoTzu() { this("Pooh"); } LaoTzu(String s) { super(s); } } class Philosopher { Philosopher(String s) { System.out.print(s + " "); } } ``` What is the result? A. Pooh Pooh **B. Pooh Tigger**(정답) C. Tigger Pooh D. Tigger Tigger E. Compilation fails due to a single error in the code. F. Compilation fails due to multiple errors in the code. 문제에서 궁금한 사항 질문드려요. 1. super class(philosopher)에는 no args 생성자가 정의되지 않았는데, subclass에서는 super에서 정의되지 않은 new LaoTzu() ; 가 가능한가요? 2. 문제의 순서상 5행에 의해 Tiger가 먼저 출력되어야 하는게 맞지 않나요? 어떻게 해서 Pooh Tiger가 출력되는 지 설명 부탁드립니다
# 생성자의 호출 순서 1) super class(philosopher)에는 no args 생성자가 정의되지 않았는데, subclass에서는 super에서 정의되지 않은 new LaoTzu() ; 가 가능한가요? 네 가능합니다. LaoTzu() 생성자를 보면 내부적으로 this("Pooh"); 를 호출하고 있습니다. this("Pooh")는 내부적으로 no args 생성자가 아닌 super(s)를 호출합니다. 2) 문제의 순서상 5행에 의해 Tiger가 먼저 출력되어야 하는게 맞지 않나요? 최종적인 출력은 "Pooh Tiger"가 맞습니다. main() 메소드의 1행인 `new LaoTzu();`가 수행될 때, 먼저 "Pooh "가 출력이 됩니다. 그다음 main() 메소드의 2행 `new LaoTzu("Tigger");`에 의해서 "Tigger"가 출력됩니다.
답변 감사합니다.