File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception Handling

 
atool pune
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i have return in my try and catch statement then will my finally block will be executed ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Peter Chase
Ranch Hand
Posts: 1970
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic