1.

Will the finally block get executed when the return statement is written at the end of try block and catch block as shown below?

Answer» PUBLIC int someMethod(int i){ try{ //some statement return 1; }CATCH(EXCEPTION e){ //some statement return 999; }FINALLY{ //finally block statements }}

finally block will be executed irrespective of the exception or not. The only case where finally block is not executed is when it ENCOUNTERS ‘System.exit()’ method anywhere in try/catch block.



Discussion

No Comment Found