• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What happens to the uncaught exceptions in finally block?

 
Tejas Jain
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will JVM ignore them?
 
Andrey Kozhanov
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, they will be thrown after finally block execution. Unless there is return statement in finally block - in this case uncaught exceptions will be ignored.
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless there is a return statement in the finally block - or unless a new exception is thrown from the finally block. Both cases result in the original exception being forgotten without a trace.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49361
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's all in the Java™ Language specification, but the answers you got here are easier to understand
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic