aspose file tools*
The moose likes Beginning Java and the fly likes Exception Handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception Handling" Watch "Exception Handling" New topic
Author

Exception Handling

atool pune
Greenhorn

Joined: Mar 03, 2008
Posts: 3
If i have return in my try and catch statement then will my finally block will be executed ?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The simplest way to find out is to put a return statment in your try or catch block and then put a call to System.out.println in your finally block.

Moving to Java In General (Beginner)


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Ben Souther:
The simplest way to find out is to put a return statment in your try or catch block and then put a call to System.out.println in your finally block.


I guess what you're saying is ShowSomeEffort.

However, I would like to take issue with the idea that experiment ("just try it") is a good way to learn what a particular statement or method does. It's all to easy to draw the wrong conclusion.

It's not like we're dealing with a "black box" here. You can just read the Sun Java Tutorial, the Sun Java API, or the Java Language Specification on the Web. I think that's a much better approach to encourage in new programmers.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception Handling
 
Similar Threads
What is your favorite letter?
Congrats Amy!
Smiley test
Where are You ?
Another 'Y' game