Adding 'throws MyException' to main() would solve this, but why am I getting this error in the finally block,while a very similar throw inside catch block works fine.
I just want JVM's default handler to catch the exception I throw from finally. Same with catch is very fine. Default handler gets it.
Is there something i'm doing wrong? Is there any helping explanation?
An NPE is a RuntimeException. MyException is not. Checked exceptions *must* be either caught, or declared to be thrown. Runtime exceptions require neither.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
4
posted
0
That looks very similar to what is discussed in this thread.
Thanks David & Campbell...I completely get that Checked/UnChecked Exceptions
I just have one more question in store, regarding this.
I tried extending 'RuntimeException' class instead of 'Exception' so that my custom exception could be an unchecked one, but i'm getting compile errors like
I just have extended RuntimeException which IS-A Throwable instance,right? though not directly. Can we not make our custom exceptions UnChecked?
oops..my mistake,my mistake. works fine when i subclass RuntimeException.
I just used 'RunTimeException' instead of 'RuntimeException'. I got some 7 compile errors..didn just focus on the very first one - cannot find symbol.
really am sorry to bother you people.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.