This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Exceptions  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one able to explain the below code why the output came abce followed by exception instead of abcde followed by exception???

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some extra info, I found this code in the book written by Jeanne Boyarsky and Scott Selikoff on page 332 in chapter 6.
 
Ranch Hand
Posts: 250
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you already know the output, the specifics are:
IllegalArgumentException thrown on line 8  is caught on line 9
RuntimeException  thrown on line 11  isn't caught;  line 11 is not "guarded" inside its own try and catch)
line 16 executes inside the finally because the finally always executes (unless System.exit(0) and/or JVM shuts down)
RuntimeException  thrown on line 17 inside the finally is never caught

 
Charles O'Leary
Ranch Hand
Posts: 250
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
Charles O'Leary
Ranch Hand
Posts: 250
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Charles O'Leary wrote:Since you already know the output, the specifics are:
IllegalArgumentException thrown on line 8  is caught on line 9
RuntimeException  thrown on line 11  isn't caught;  line 11 is not "guarded" inside its own try and catch)
line 16 executes inside the finally because the finally always executes (unless System.exit(0) and/or JVM shuts down)
RuntimeException  thrown on line 17 inside the finally is never caught


My apologies for the re-numbering:
Untitled.png
[Thumbnail for Untitled.png]
 
Evil is afoot. But this tiny ad is just an ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!