Given:
3. class Button { 4. Button() { System.out.print("b "); } 5. Button(String name) { 6. this(); System.out.print("bn " + name); 7. } /*from w ww . j a v a 2s . c o m*/ 8. } 9. public class HomeButton extends Button { 10. HomeButton() { System.out.print("h "); } 11. HomeButton(String name) { 12. this(); System.out.print("hn " + name); 13. } 14. public static void main(String[] args) { new HomeButton("x "); } 15. }
What is the result?
C is correct.
The constructors call their superclass constructors, which execute first, and that constructors can be overloaded.