About Question enthuware.ocajp.i.v7.2.1345 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
patrickK
Posts: 3
Joined: Sun Jun 03, 2012 5:45 pm
Contact:

About Question enthuware.ocajp.i.v7.2.1345 :

Post by patrickK »

I have a couple issues with this question.

First, the wording suggests there is only one correct answer: "What is the correct way," (singular) not "What are correct ways" (plural). This is misleading since it is actually looking for two options to be selected.

Second, using throws Throwable is an acceptable or possible way that compiles, but I would not call it "the correct way." I would say the correct way would be to declare the actual exception thrown. If it throws more than one, then use the most specific parent class that includes both.

Since the question says that it raises a checked exception, which is therefore a subclass of Exception, that would seem to me like the correct way to declare it. Again, throws Throwable is acceptable and compiles but seems confusing if the method doesn't actually throw Error. It seems like the question should be reworded to ask "what are the possible ways to declare that method so that it indicates that it expects the caller to handle that exception?"

admin
Site Admin
Posts: 10389
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1345 :

Post by admin »

You are right. Fixed.
thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests