Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interesting observation about exceptions

 
jayesh bindra
Greenhorn
Posts: 26
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is also more commonly known as the case of the LOST EXCEPTION.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic