One of the answers is the overiding method must not throw any exceptions that may not be thrown by the overridden method. My question is what about a RuntimeException. What if I throw an ArithmeticException explicitly only in the overiding method. void overriddenMethod() { } void overridingMethod() throws ArithmeticException { }
Uvnik Gupta
Ranch Hand
Joined: Jul 24, 2000
Posts: 32
posted
0
The statement is a bit ambiguous. If it means only checked exceptions then it's correct but if it means any kind of exception, it's wrong.
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
posted
0
A RuntimeException can be thrown by the overridden method or the overriding method. The statement only talks about exceptions that can not be thrown by the overridden class, and so it has nothing to with RuntimeExceptions (or Errors for that matter). The statement is definitely true.
"I'm not back." - Bill Harding, Twister
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.