This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes try catch and finally blocks Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "try catch and finally blocks" Watch "try catch and finally blocks" New topic
Author

try catch and finally blocks

narasimha munagala
Greenhorn

Joined: Aug 12, 2007
Posts: 7
Hi to everyone
I am new to java i want to know
in all the try ,catch,finally blocks return statements exists
if an exception raised in the try block then which return
statement execute
and if an exception not raised in the try block then
which return stetment execute.
Any one know answer for this question please give me answer
thank you
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
The return statements for both the try and catch blocks will get suppressed by the finally block. You'll end up with the return value from your finally block whether an exception is thrown or not.

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: try catch and finally blocks
 
Similar Threads
try,catch and finally blocks
try catch and finally blocks
"return" inside the try-catch-finally
Try an Finally Working Confusion