?? lostmessage18.java
字號:
// exceptions/LostMessage18.java
// TIJ4 Chapter Exceptions, Exercise 18, page 479
// Add a second level of exception loss to LostMessage.java so that the
// HoHumException is itself replaced by a third exception.
class VeryImportantException extends Exception {
public String toString() {
return "A very important exception!";
}
}
class HoHumException extends Exception {
public String toString() {
return "A trivial exception";
}
}
class MeaninglessException extends Exception {
public String toString() {
return "A meaningless exception";
}
}
public class LostMessage18 {
void f() throws VeryImportantException {
throw new VeryImportantException();
}
void dispose() throws HoHumException {
throw new HoHumException();
}
void eliminate() throws MeaninglessException {
throw new MeaninglessException();
}
public static void main(String[] args) {
try {
LostMessage18 lm = new LostMessage18();
try {
try {
lm.f();
lm.dispose();
} finally {
lm.eliminate();
}
} catch(Exception e) {
System.out.println(e);
}
} catch(Exception e) {
System.out.println(e);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -