How to rewrite the following code
try (A a = new A(); B b = new B()) {
//useful work here
}
catch (Exception e) {
//other code
}
using try-catch-finally construction?
If we were only creating one resource there is a nice link here.
Unfortunately, I don't understand how to generalize this when we creating multiple resources.
One thing I don't understand is how do we recognize that something happened to a
and didn't happen to 'b' and vice versa.