the question gives you this code and asks about the result
Answers :
A. Compilation succeeds
B. Compilation fails due to an error on line 8
C. Compilation fails due to an error on line 10
D. Compilation fails due to an error on line 12
E. Compilation fails due to an error on line 14
what are you considering this?
the CC5 class doStuff() method does not declare any new or broader checked exceptions and it compiles fine
so the answer is only C
because we cannot declare any new checked exceptions or broader exceptions for the overriding method
happy learning
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Prasad Kharkar wrote:what are you considering this?
the CC5 class doStuff() method does not declare any new or broader checked exceptions and it compiles fine
so the answer is only C
because we cannot declare any new checked exceptions or broader exceptions for the overriding method
happy learning
of course there is not need to declare that it throws subException
Remember
when overriding the method you can either declare fewer exceptions, no exceptions or narrower exceptions for demonstrating my point
here is the sample program
that compiles fine
hope this helps
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right