锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产伦久视频在线观看,久久午夜免费电影,久久综合九色综合欧美98http://www.aygfsteel.com/xun56789/archive/2008/08/19/223117.htmlxunSir.leexunSir.leeTue, 19 Aug 2008 14:19:00 GMThttp://www.aygfsteel.com/xun56789/archive/2008/08/19/223117.htmlhttp://www.aygfsteel.com/xun56789/comments/223117.htmlhttp://www.aygfsteel.com/xun56789/archive/2008/08/19/223117.html#Feedback0http://www.aygfsteel.com/xun56789/comments/commentRss/223117.htmlhttp://www.aygfsteel.com/xun56789/services/trackbacks/223117.html 濡傛灉涓嶆槸寰堟湁蹇呰錛屽氨Exception灝監(jiān)K浜?br />
 1public class Demo {
 2    public static void main(String args[]) {
 3        int i = 0;
 4        try {
 5            if (i == 0{
 6                throw new LeafException();
 7            }

 8        }
 catch (TreeException e) {
 9            e.printStackTrace();
10        }

11    }

12}

13
14class TreeException extends Exception{
15    public TreeException () {
16        System.out.println("TreeException()");
17    }

18}

19
20class LeafException extends TreeException{
21    public LeafException () {
22        System.out.println("LeafException()");
23    }

24}

鎵撳嵃緇撴灉錛?br /> TreeException()
LeafException()
LeafException
        at Demo.main(Demo.java:6)

xunSir.lee 2008-08-19 22:19 鍙戣〃璇勮
]]>
綾葷殑緇ф壙http://www.aygfsteel.com/xun56789/archive/2008/08/18/222885.htmlxunSir.leexunSir.leeMon, 18 Aug 2008 14:13:00 GMThttp://www.aygfsteel.com/xun56789/archive/2008/08/18/222885.htmlhttp://www.aygfsteel.com/xun56789/comments/222885.htmlhttp://www.aygfsteel.com/xun56789/archive/2008/08/18/222885.html#Feedback2http://www.aygfsteel.com/xun56789/comments/commentRss/222885.htmlhttp://www.aygfsteel.com/xun56789/services/trackbacks/222885.html     1錛氬瓙綾繪柟娉曚紭鍏堟绱㈠茍浣跨敤瀛愮被鐨勬柟娉?br />     2錛氬瓙綾諱笌鐖剁被鐨勫睘鎬ч兘鏄瓨鍦紝寮曠敤綾誨瀷鏄埗綾繪椂灝變嬌鐢ㄧ埗綾誨睘鎬э紝鏄瓙綾誨氨浣跨敤瀛愮被灞炴?br />     3
錛氳皟鐢ㄧ埗綾繪柟娉?super.method())錛岀埗綾繪柟娉曚腑錛?br />         璋冪敤鏂規(guī)硶錛屼紭鍏堟悳绱㈠瓙綾諱腑鏄惁鏈夎鏂規(guī)硶錛岀劧鍚庢槸鐖剁被鐨勶紱
        璋冪敤灞炴э紝鍒欐槸浣跨敤鐖剁被鐨勫睘鎬с?br />
 1class Tree {
 2    int i = 3, j = 5;
 3
 4    public Tree() {
 5        this.show("Tree");
 6    }

 7
 8    protected void show(String s) {
 9        System.out.println(s);
10    }

11
12    public void t() {
13        this.show("Tree, t");
14        System.out.println(this.i);
15        System.out.println(this.j);
16    }

17}

18
19class Leaf extends Tree {
20    int i = 10;
21
22    public Leaf () {
23        this.show("Leaf");
24    }

25
26    public void show(String s) {
27        System.out.println(s + "\t\tLeaf");
28    }

29
30    public void t() {
31        show("Leaf, t");
32        System.out.println(this.i);
33        System.out.println(this.j);
34        System.out.println();
35        super.t();
36    }

37
38    public static void main(String args[]) {
39        Leaf l = new Leaf();
40        l.t();
41
42        System.out.println("------------------");
43        System.out.println(l.i);
44        Tree t = new Leaf();
45        l = (Leaf) t;
46        System.out.println(t.i);
47        System.out.println(l.i);
48    }

49}

50


鎵撳嵃緇撴灉錛?br />

 

Tree            Leaf
Leaf            Leaf
Leaf, t         Leaf
10
5

Tree, t         Leaf
3
5
------------------
10
Tree            Leaf
Leaf            Leaf
3
10



xunSir.lee 2008-08-18 22:13 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 黄龙县| 汽车| 临颍县| 浠水县| 萨迦县| 黄山市| 泽普县| 新郑市| 黑龙江省| 防城港市| 布尔津县| 额尔古纳市| 巴林右旗| 江源县| 云龙县| 噶尔县| 琼结县| 若羌县| 水富县| 莱阳市| 宁都县| 朝阳县| 沙雅县| 横峰县| 呼伦贝尔市| 道真| 江川县| 连江县| 宁南县| 房山区| 鄂州市| 原平市| 贵阳市| 台东县| 金寨县| 盐边县| 华池县| 外汇| 平谷区| 滦南县| 霍林郭勒市|