[4428] in java-interest

home help back first fref pref prev next nref lref last post

Re: finally statement

daemon@ATHENA.MIT.EDU (James Knighten(am one!))
Sun Dec 24 23:03:22 1995

Date: Mon, 25 Dec 95 11:37:27 JST
From: knightjm@pms.mmlab.toshiba.co.jp (James Knighten(am one!))
To: java-interest@java.sun.com

	
I wrote:
>I've been reading about exception handling in the JDK-beta2 tutorial (/java/
>exceptions/* group of html files). I read the reasons for having a finally 
>block at the end of a try-catch block in /java/exceptions/finally.html, but 
>I still don't understand the need for a finally block.....
>.......
>Lastly, I'm assuming that if an error occurs inside the finally block it 
>will be treated like any other exception that occurs outside the try block.
>

Jeremy, Hanpeter and Arnold replied that a finally block is executed even
if...
  a. There is an exit or return in a catch block
  b. There is an uncaught exception in the try block (this includes a
     runtime exception as well)
  c. There is an uncaught exception in a catch block (this includes a 
     runtime exception as well)

Also, an exception in the finally block must be handled by it's own try-
catch block or thrown.

I really appreciate your responses since my experience with try-catch
statements is limited.
thanks again, jim
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post