国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

java進行error捕獲和處理示例(java異常捕獲)

2019-11-26 15:47:17
字體:
來源:轉載
供稿:網友

下面給個小例子,來驗證一下error的捕獲。

復制代碼 代碼如下:

public class TestCatchError extends Error{

    private static final long serialVersionUID = -351488225420878020L;

    public TestCatchError(){
        super();
    }

    public TestCatchError(String msg){
        super(msg);
    }

    public static void main(String[] args) {
        try {
            throw new TestCatchError("test catch error");
        } catch (Throwable t) {
            System.out.println("step in the catch ~");
            t.printStackTrace();
        }
    }
}

運行結果:

復制代碼 代碼如下:

step in the catch ~
TestCatchError: test catch error
at TestCatchError.main(TestCatchError.java:23)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临漳县| 金门县| 淮滨县| 吉木乃县| 西峡县| 湘乡市| 边坝县| 商都县| 佛学| 台山市| 宜丰县| 汉中市| 沁源县| 阿尔山市| 驻马店市| 上犹县| 桂阳县| 铅山县| 永济市| 诏安县| 清原| 山丹县| 枝江市| 开原市| 读书| 石景山区| 翼城县| 昭平县| 桑日县| 报价| 铜鼓县| 林芝县| 佛山市| 晋宁县| 白沙| 迁安市| 灌阳县| 江津市| 浮山县| 稻城县| 龙井市|