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