should finally block be the last executing block in a function?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After finally block executes, the control goes back to the
caller..I was expecting the control to go to the next
statement after the finally block. Thanks for your input.
 
After finally block executes, the control goes back to the
caller..I was expecting the control to go to the next
statement after the finally block. Thanks for your input.

It depends on what happened in the try block. If an exception was
thrown, or the method returned, then the method will be popped off the
stack. Otherwise, control will indeed go to the next statement after
the finally block.

Could you post a short example of some code which defies your
expectations?
 
Back
Top