Page 1 of 1

Exceptions

Posted: Mon Feb 24, 2014 3:29 am
by arjun gaur
q-46 of 91 QID Test 5
Drag and Drop type..
A piece of code is given and we have to tell the type of exception thrown by that code..
check the fourth option ,it's a static block that throws an exception.Why won't it throw an ExceptionInitializerError exception ??it says no exception.although any exception thrown by a static block is wrapped into an ExceptionInitializerError.

Re: Exceptions

Posted: Mon Feb 24, 2014 3:38 am
by admin
Please quote qid so that I can look it up. There is a discuss button on the question screen at the bottom that will open the right topic for that question.

BTW, for an exception to be thrown, the code has to compile first.

-Paul.

Re: Exceptions

Posted: Mon Feb 24, 2014 3:50 am
by arjun gaur
enthuware.ocajp.i.v7.2.1250

Re: Exceptions

Posted: Mon Feb 24, 2014 4:26 am
by admin
2.1250 is a different question. It is not a drag and drop. But again, for an exception to be thrown, the code has to compile first. That is why ExceptionInInitializerError is incorrect.