課程
/后端開發(fā)
/Java
/Java入門第三季
getMessage()方法、printStackTrace()方法以及toString()方法
2017-02-22
源自:Java入門第三季 1-9
正在回答
package?test; public?class?Test?{ ????public?static?void?main(String[]?args)?{ ????????try{ ????????????System.out.println(1/0); ????????}?catch?(Exception?e)?{ ????????????System.out.println(e.getMessage());?//?打印異常信息 ????????????System.out.println("*********************"); ????????????System.out.println(e.toString());???//?打印異常類型+異常信息 ????????????System.out.println("*********************"); ????????????e.printStackTrace();????????????????//?打印異常類型+異常信息+異常堆棧 ????????} ????} }
for__what 提問者
ziom 回復(fù) for__what 提問者
for__what 提問者 回復(fù) ziom
舉報(bào)
Java中你必須懂得常用技能,不容錯(cuò)過的精彩,快來加入吧
3 回答異常處理:
1 回答parse()方法怎么進(jìn)行異常處理啊?
2 回答自定義異常方法
1 回答異常處理的作用
3 回答異常處理的時(shí)間
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-02-22