?? exceptionexample.java
字號:
//ExceptionExample.java
public class ExceptionExample
{
public static void main(String[] args)
{
try{
//使用給定字符串"I throw an Exception!!!"作為詳細(xì)信息來構(gòu)造Exception對象。
throw new Exception("I throw an Exception!!!");
}catch(Exception e) //可以捕獲所有異常類型
{
System.out.println("Caught the Exception!!!");
//輸出該對象的詳細(xì)信息。
System.out.println("e.getMessage(): " + e.getMessage());
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -