posts - 33,  comments - 17,  trackbacks - 0
1public class Plate {
2    Plate(int i) {
3        System.out.println("Plate Constructor");
4    }

5}

1public class DinnerPlate extends Plate{
2    public DinnerPlate(int i) {
3        super(i);
4        System.out.println("DinnerPlate Constructor");
5    }

6}

1public class Utensil {
2    public Utensil(int i) {
3        System.out.println("Utensil Constructor");
4    }

5}

1public class Spoon extends Utensil {
2    public Spoon(int i) {
3        super(i);
4        System.out.println("Spoon Constructor"  + "    " + i);
5    }

6}

1public class Fork extends Utensil {
2    public Fork(int i) {
3        super(i);
4        System.out.println("Fork Constructor");
5    }

6}

1public class Knife extends Utensil {
2    public Knife(int i) {
3        super(i);
4        System.out.println("Knife Constructor");
5    }

6}

1public class Custom {
2    public Custom(int i) {
3        System.out.println("Custom Constructor");
4    }

5}

虽然编译器强制去初始化父类,并且要求要在构造器起始处就要这么做,但是它并不监督你必须将成员对象也初始化,因此这一点自己必须时刻注意。
posted on 2008-07-07 14:22 scea2009 阅读(155) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

<2008年7月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

常用链接

留言簿(1)

随笔分类

随笔档案

PL/SQL存储过程与函数

搜索

  •  

最新评论

阅读排行榜

评论排行榜