📄 catchexception.java
字号:
package example8;public class CatchException { public static void a() throws MyException{ System.out.println("Throwing MyException from a()"); throw new MyException(); } public static void b() throws MyException{ System.out.println("Throwing MyException from b()"); throw new MyException("Originated in b()"); } public static void c() throws MyException{ System.out.println("Throwing MyException from c()"); throw new MyException("Originated in c()",47); } public static void main(String[] args) { try{ a(); } catch(MyException e){ e.getMessage(); } try{ b(); } catch(MyException e){ e.toString(); } try{ c(); } catch(MyException e){ e.printStackTrace(); System.out.println("error code:"+e.val()); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -