Java编程思想 (第4版) 9.1分
读书笔记 异常丢失
Excelsior

class VeryImportantExeption extends Exception{

@Override

public String toString() {

return "a Very Important Exeption !";

}

}

class HoHumException extends Exception{

@Override

public String toString() {

return "a trivial Exeption !";

}

}

public class LostMessage {

void f() throws VeryImportantExeption{

throw new VeryImportantExeption();

}

void dispose() throws HoHumException{

throw new HoHumException();

}

public static void main(String[] args) {

try {

LostMessage lm=new LostMessage();

try {

lm.f();

} finally {

lm.dispose();

}

} catch(Exception e) {

System.out.println(e);

}

}

public class ExceptionSilencer {

public static void main(String[] args) {

try {

throw new RuntimeException();

} finally {

return;

}

}

}

0
《Java编程思想 (第4版)》的全部笔记 360篇
豆瓣
免费下载 iOS / Android 版客户端