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.
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
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: