super关键字

 1 class FatherClass {
 2     public int value;
 3     public void f(){
 4         value = 100;
 5         System.out.println
 6         ("FatherClass.value="+value);
 7     }
 8 }
 9 
10 class ChildClass extends FatherClass {
11     public int value;
12     public void f() {
13         super.f();
14         value = 200;
15         System.out.println
16              ("ChildClass.value="+value);
17         System.out.println(value);
18         System.out.println(super.value);
19     }
20 }
21 
22 public class TestInherit {
23     public static void main(String[] args) {
24         ChildClass cc = new ChildClass();
25         cc.f();
26     }
27 }

posted @ 2013-04-02 20:43  glt66  阅读(122)  评论(0编辑  收藏  举报