标签:span 替代 turn color try xtend via thinking message
采用finally从句中的,可能会丢失异常
package thinking; //: LostMessage.java // How an exception can be lost class VeryImportantException extends Exception { public String toString() { return "A very important exception!"; } } class HoHumException extends Exception { public String toString() { return "A trivial exception"; } } public class LostMessage { void f() throws VeryImportantException { throw new VeryImportantException(); } void dispose() throws HoHumException {throw new HoHumException();} public static void main(String[] args) throws Exception { LostMessage lm = new LostMessage(); try { lm.f(); } finally { lm.dispose(); } } } ///:~
VeryImportantException 被finally从句中的HoHumException的异常替代了,即出错信息丢失了。
标签:span 替代 turn color try xtend via thinking message
原文地址:https://www.cnblogs.com/newlangwen/p/9191454.html