📄 exceptionexample.java
字号:
//ExceptionExample.java
public class ExceptionExample
{
public static void main(String[] args)
{
try{
//使用给定字符串"I throw an Exception!!!"作为详细信息来构造Exception对象。
throw new Exception("I throw an Exception!!!");
}catch(Exception e) //可以捕获所有异常类型
{
System.out.println("Caught the Exception!!!");
//输出该对象的详细信息。
System.out.println("e.getMessage(): " + e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -