因为静态方法不能被覆盖,如果在子类出现了同签名的就是隐藏,非静态方法称之为覆盖 区别在哪呢,比如有两个类Father和Son public class Father { public static void statMethod(){ } public void nonstatMethod() { } } public class Son extends Father { public static void statMethod(){ } public void nonstatMethod() { } } 如果Father father = new Son(); father.statMethod();调用的是父类的方法(隐藏) father.nonstatMethod();调用的是子类的方法(覆盖)
另外还有若Son son=new Son();
son.statMethod();调用的是子类的方法(隐藏)
father.nonstatMethod();调用的是子类的方法(覆盖)
son.nonstatMethod();调用的是子类的方法(覆盖)