try
B
finally F
B and F are code blocks. (i) Show how you will write the above code using the try-catch assuming that only exceptions can cause a statement to terminate abruptly; (ii) Does your transformation work if return statements may also cause a statement to terminate abruptly? If your answer is "yes", then argue why. If your answer is "no", then explain why not and suggest one way of making it work.
class E1 extends Exception {...}
class E2 extends Exception {...}
class E3 extends Exception {...}
void f() throws Exception {
try {
try {
B0
}
catch (E1 e11) {... B1 ...}
}
catch (E1 e12) { ... B2 ...}
}
void g() {
try {
f()
}
catch (Exception e) { ... B3 ...}
}
Assume that B0, B1, B2, and B3 are code blocks that may throw an exception but do not contain any try statements.