子类对象new的时候堆里的内存分配:
1. 父类成员变量
2. 子类成员变量
3. this对象指向自己
4. super对象指向父类
super调用父类的方法:
class FatherClass { public int value; public void f(){ value = 100; System.out.println ("FatherClass.value="+value); } } class ChildClass extends FatherClass { public int value; public void f() { super.f(); value = 200; System.out.println ("ChildClass.value="+value); System.out.println(value); System.out.println(super.value); } } public class TestInherit { public static void main(String[] args) { ChildClass cc = new ChildClass(); cc.f(); } }