Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exceptions.Any help.

 
Siddhu
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q)if an exception is not caught, the finally block will run and the rest of the method is skipped.
Is this true.
When the exception is not caught the finally block runs and again exception passes into the same method,.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it's true. Because the exception has to be handled somewhere, and since it's not going to be in the method (it wasn't caught), then it has to propagate upwards (the exception) and control must leave the method in which the Exc was thrown and not caught (AFTER executing the finally if present, of course).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic