This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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.
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?
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: