posted 14 years ago
My question is on page 421, Q15 Chapter 5 of KB's book. I simplified the question into several codes below.
My first question is that would this example 1 compile? If not, I need to throw RuntimeException, correct? If yes, how main handles the exception?
My second question is that would this example 2 compile?
In example 3, class B extends A, which does not declare any exception. However, the overriding method doStuff() declares an exception. Is it fine to have the overriding method doStuff() (B.doStuff()) to declare an exception without its overridden method (A.doStuff()) declaring an exception? why and why not?
Always speak up for stupid questions.