标签:ext [] system public print ima oid 内存 nbsp
在java中使用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(); } }
内存图如下:
标签:ext [] system public print ima oid 内存 nbsp
原文地址:https://www.cnblogs.com/white-the-Alan/p/10169454.html