This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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
Pie
Posts: 49772
69
  • 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
Pie
Posts: 49772
69
  • 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