📄 exceptiontest.java
字号:
package sample;
class MyException extends Exception {
public MyException(String msg){ super(msg); }
public MyException() { this("My Exception"); }
}
public class ExceptionTest {
private static int i = 1;
/** Creates a new instance of ExceptionTest */
public ExceptionTest() {
}
public static void main(java.lang.String[] arg) {
try{ a();
}catch(MyException e){ System.out.println(e.getMessage()) ;}
}
private static void a() throws MyException {
int i = 0;
if(i < 10) throw new MyException("new desc");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -