Given:
3. public class Main extends Car { 4. Main() { System.out.println("r "); } 5. public static void main(String[] args) { 6. new Main(); 7. } /*from w ww . j a va 2 s . c o m*/ 8. } 9. class Car extends Shape { 10. Car() { System.out.print("c "); } 11. private Car(String s) { } 12. } 13. abstract class Shape { 14. Shape() { System.out.print("s "); } 15. }
What is the result?
D is correct.
It's legal for abstract classes to have constructors, and it's legal for a constructor to be private.
Normal constructor chaining is the result of this code.