📄 exceptionmethoddemo.java
字号:
public class ExceptionMethodDemo {
public static void main( String args[] )
{
try {
method1();
}
catch ( Exception exception ) {
System.out.println( exception.getMessage() );
exception.printStackTrace();
}
}
public static void method1() throws Exception
{
method2();
}
public static void method2() throws Exception
{
throw new Exception( "Exception thrown in method2" );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -