Originally posted by vishnu prakash:
I think there are differences between throwing a exception either
explicitly (or) programatically and return statement in a finally block
The return statement nullifies any previous exception and makes sure
the programs flow continues normally. Regarding a exception thrown inside
a finally block even though it discards any previous exceptions( either is try block (or) catch block) still it generates a new exception and you will see a stack trace print during runtime.
just pls give final confirmation to my earlier post..
if i m putting statement "throw IOException" in finally clause it is saying this
^
ExceptionHandling.java:18: unreported exception java.io.IOException; must be cau
ght or declared to be thrown
throw new IOException();
^
what does that mean ?
and how to handle this...
How to handle the exception thrown in finally block
and as in my last post above how to catch the exception thrown in the catch block ( even it is discared by finally return statement )
what if i specifically wanted to catch the excption thrown in catch block ?
how do will do ? suppose i wanted to close some communciation I/O or etc...
pls reply