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

Interesting observation about exceptions

 
jayesh bindra
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
At any given time only one exception can exist. In case there is an exception to be caught, and another exception takes place, the first one ceases to exist. Therefore when exceptions are to be caught, only the one which is thrown last is caught.
Consider the following code..

The output of this is...
In Inner catch java.lang.ArrayIndexOutOfBoundsException: Inner
In Inner finally
Outer catch java.lang.NullPointerException: Inner finally
I think the output now needs no explanation.
Regards,
Jayesh.

[This message has been edited by jayesh bindra (edited July 16, 2000).]
 
Junaid Bhatra
Ranch Hand
Posts: 213
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is also more commonly known as the case of the LOST EXCEPTION.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic