先上例子代码public class F { int age = 5; public F() { print(); } public void print() { System.out.println(age); }}然后让S继承F类,覆盖父类的age属性和print方法public class S extends F { int age = 10; public S() { print(); } public void print() { System.out.println(age); ... Read More