Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

understanding when JVM might exit

 
nitinram agarwal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was reading some article regarding exception handling and came across the following comment that the finally block may not be executed if the JVM exits. so I tried with the following simple example



and can see that the SOP in the finally block is not printing.
I want to understand the other scenarios in which the JVM might exit. I tried putting some code in the try block which throws ArrayIndexOutOfBoundsException but it is printing the statement in the finally block.
 
Campbell Ritchie
Sheriff
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at this post.
 
nitinram agarwal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot for pointing to the article . it was reallly very useful
 
Campbell Ritchie
Sheriff
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome And the bit about the meteor is so memorable
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic