aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interesting observation about exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interesting observation about exceptions" Watch "Interesting observation about exceptions" New topic
Author

Interesting observation about exceptions

jayesh bindra
Greenhorn

Joined: Jun 18, 2000
Posts: 26
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

Joined: Jun 27, 2000
Posts: 213
This is also more commonly known as the case of the LOST EXCEPTION.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interesting observation about exceptions