📄 exceptiontest3.java
字号:
class customExcep extends Exception {
public customExcep() {}
public customExcep(String strObj) {
super(strObj);
}
}
public class ExceptionTest3 {
public static void exceptionThrow() throws customExcep {
System.out.println(
"Throwing Exception from exceptionThrow()");
throw new customExcep();
}
public static void anotherThrow() throws customExcep {
System.out.println(
"Throwing Exception from anotherThrow()");
throw new customExcep("Generated from anotherThrow()");
}
public static void main(String[] args) {
try {
System.out.println("Test one exception:");
exceptionThrow();
} catch(customExcep e) {
e.printStackTrace();
}
try {
System.out.println("Test another exception:");
anotherThrow();
} catch(customExcep e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -