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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top