📄 throwsdemo.java
字号:
import java.io.*;
public class ThrowsDemo {
void throw1() throws FileNotFoundException
{
throw new FileNotFoundException ( "excp1" );
}
void throw2() throws Exception
{
try {
System.out.println( "Call method throw1" );
throw1();
}
catch ( Exception e ) {
System.out.println( "Caught in throw2:" + e );
throw e;
}
}
public static void main( String args[] )
{
ThrowsDemo app = new ThrowsDemo();
try {
System.out.println( "Call method throw2" );
app.throw2();
}
catch ( Exception e ) {
System.out.println( "Caught in main:" + e );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -