国产探花免费观看_亚洲丰满少妇自慰呻吟_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)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 海盐县| 陕西省| 连江县| 榆社县| 三穗县| 枞阳县| 郯城县| 石棉县| 甘德县| 红河县| 丰原市| 湛江市| 寿光市| 九台市| 灵武市| 昭觉县| 内黄县| 新营市| 福建省| 二连浩特市| 惠安县| 任丘市| 北流市| 阜新| 乐亭县| 东平县| 炉霍县| 忻州市| 中牟县| 英德市| 汝州市| 吉林市| 南平市| 阳山县| 龙南县| 新河县| 仁寿县| 胶南市| 肥乡县| 鱼台县| 肃北|