package test; /** * @author lidongbo */ public class Father { public static void say(){ System.out.println("教训儿子!"); } }
package test; /** * @author lidongbo */ public class Child extends Father { public static void say(){ System.out.println("我很委屈!"); } public static void main(String[] args) { Father father=new Child(); father.say();//相当于Father.say();,当然了,静态方法和Class一起分配的和具体实例没关系,当然覆盖不了了,我证明了我的猜测 } }