About Question enthuware.ocajp.i.v8.2.1385 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1385 :

Post by admin »

It is not about whether the exception in the catch block is same or not. You need to see if the exception thrown in the try block satisfies the "is-a" test with respect to the exception class mentioned in the catch block.
For example, in this case, you need to see whether an instance of ArrayIndexOutOfBoundsException is-a MySpecialException? No. So an instance of ArrayIndexOutOfBoundsException cannot be caught by MySpecialException.

If the code in the try block threw an instance of a subclass of of MySpecialException, then it would have been caught by the given catch block.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Kevin30
Posts: 28
Joined: Sun Oct 25, 2015 10:14 am
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1385 :

Post by Kevin30 »

Thank you!
It is clear now.

Post Reply

Who is online

Users browsing this forum: No registered users and 92 guests