File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception handling

 
manasa teja
Ranch Hand
Posts: 325
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any exception case to the following statement?
In a try-catch-finally construct, if a finally block is present, then it is guaranteed to be executed.
-thanks
Murthy
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the program were to terminate prior to that, the finally block would not be exeucted.
Take this example:

Corey
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, if an exception is thrown inside the finally block and is not caught within the same scope, the exception will propagate outwards and the finally block will not complete its execution.
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Only if you call System.exit before the flow reaches the finally block.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic