This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes return in catch block! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "return in catch block!" Watch "return in catch block!" New topic

return in catch block!

Nick Petas
Ranch Hand

Joined: Jan 31, 2007
Posts: 38
What does a single return in a catch block do?
Thank you.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Nothing less or more then a regular return statement. Why don't you try it?

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Nick Petas
Ranch Hand

Joined: Jan 31, 2007
Posts: 38
Where exactly does it return?In the try block?
Stephan van Hulst

Joined: Sep 20, 2010
Posts: 3575

The same place it returns to outside the try block. Ask yourself, where does return normally return to?
I agree. Here's the link:
subject: return in catch block!
Similar Threads
missing expression error
question about return?
catch statements
Statement not reachable??