📄 rethrowing.java
字号:
//Demonstrating fillInStackTrace( )
public class Rethrowing
{ public static void f( ) throws Exception
{ System.out.println("在 f( ) 中发生一个异常");
throw new Exception("从 f( ) 中抛出的异常");
}
public static void g( ) throws Throwable
{ try
{ f( );}
catch(Exception e)
{ System.out.println("在 g( ) 中的异常路径,e.printStackTrace( )");
e.printStackTrace( );
throw e;
}
}
public static void main(String args[ ]) throws Throwable
{ try
{ g( );}
catch(Exception e)
{ System.out.println("在主方法中捕捉到异常,e.printStackTrace( )");
e.printStackTrace( );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -