File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JQ+: Question ID :960680824810 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JQ+: Question ID :960680824810" Watch "JQ+: Question ID :960680824810" New topic
Author

JQ+: Question ID :960680824810

Rodney Woodruff
Ranch Hand

Joined: Dec 04, 2001
Posts: 80
Question ID :960680824810
An overriding method can declare ArithmaticException in it's throws clause even if the overridden method does not have any throws clause.
True or False.
I chose "False". I must admit, wording is really confusing. Can someone clarify this for me? Thanks alot.


Hope This Helps
Steven Wong
Ranch Hand

Joined: Mar 07, 2002
Posts: 295

Question ID :960680824810
An overriding method can declare ArithmaticException in it's throws clause even if the overridden method does not have any throws clause.
True or False.

Hi, the answer is True. Because the ArithmeticException is an unchecked exception(runtime exception) and thus does not need to be caught or handled.
Clement


best regards,<br />Steven<br />SCJP, SCEA
Rodney Woodruff
Ranch Hand

Joined: Dec 04, 2001
Posts: 80
Thanks Clement! The wording was really confusing. I get it now. I just wish that they could have worded it a little better.
Gautam Sewani
Ranch Hand

Joined: Apr 19, 2002
Posts: 93
Does that mean that there are no restrictions on an overriding method in the throws clause incase of unchecked exceptions?
If the overriden method does not specify any unchecked exceptions,still the overriding method can specify them in its throws clause.
Is this right?
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
There are no rules based on unchecked exceptions. That's why they're called "unchecked" exceptions. In fact, even if a method declares that it throws an unchecked exception, the invoking method need not handle it.
This code compiles and runs fine:

Corey


SCJP Tipline, etc.
 
jQuery in Action, 2nd edition
 
subject: JQ+: Question ID :960680824810