In Java 7's try-with-resources, I don't know which order the finally block and the auto-closing happens. What's the order?
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()?
}
The resource gets closed before catch or finally blocks. See this tutorial.
To evaluate this is a sample code:
Output: