Given:
2. public class Main extends Shape { 3. public static void main(String[] args) { 4. new Main(); 5. new Main("Tigger"); 6. } // w w w . j a v a 2s . co m 7. Main() { this("Pooh"); } 8. Main(String s) { super(s); } 9. } 10. class Shape { 11. Shape(String s) { System.out.print(s + " "); } 12. }
What is the result?
B is correct.
The no-arg Main constructor invokes the other Main constructor (via "this"), and the second Main constructor chains to the Shape's constructor (via "super").