一个Java方法覆盖的小问题
1 class SuperClass{ 2 3 public SuperClass() { 4 System.out.println("superclass "); 5 show(); 6 } 7 public void show() { 8 System.out.println("super class show !"); 9 } 10 } 11 class Subclass extends SuperClass{ 12 13 public Subclass() { 14 super(); 15 super.show(); 16 System.out.println("subclass "); 17 show(); 18 } 19 public void show(){ 20 21 System.out.println("sub class show !"); 22 } 23 24 } 25 public class Test { 26 public static void main(String[] args) { 27 Subclass sub = new Subclass(); 28 } 29 }
为什么这个结果?????