在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()?
}
catch
块中处理。 - jmjrollback()
方法,但事实并非如此。建议参考 https://dev59.com/H3VC5IYBdhLWcg3wqzLV#218495。 - Zyl