Without using finally, how can we execute any compulsory statement even after exception is thrown ?? Furthermore, the variables used or the method has scope only inside the try block. This question was asked by me in a interview. please suggest the answer.
try{
//........ statement 1
// ....... statement 2 might throw an Exception
// ....... statement 3 - A compulsory statement
needs to be executed even if exception is thrown.
}
catch {
}