先上例子代码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
posted @ 2013-11-07 16:47 带狗狗带 Views(356) Comments(0) Diggs(0) Edit