【发布时间】:2014-07-30 12:19:17
【问题描述】:
在 Java 7 的 try-with-resources 中,我不知道 finally 块和自动关闭发生的顺序。顺序是什么?
BaseResource b = new BaseResource(); // not auto-closeable; must be stop'ed
try(AdvancedResource a = new AdvancedResource(b)) {
}
finally {
b.stop(); // will this happen before or after a.close()?
}
【问题讨论】:
标签: java java-7 finally try-with-resources