I think the ans to your question is that while overriding we can specify a Subset of the exception of the base class in the derived class method but this thing is true only for Checked Exceptions.
RuntimeExceptions and Errors are not checked exceptions and the compiler does not checks whether the overriding method is throwing proper subclasses of RuntimeExceptions and Errors.
Please Correct me if I am wrong.
Regards<br />Sandy<br />[SCJP 5.0 - 75%]<br />[SCWCD 1.4 - 85%]<br />------------------<br />Tiger, Tiger burning bright,<br />Like a geek who works all night,<br />What new-fangled bit or byte,<br />Could ease the hacker's weary plight?
Mr. Sandeep , U Are Olright.Sinse Error And RuntimeException Are UnChecked EXception,they Need Not 2 B Included In throws Clause.Also They Can b Included In Throws Clause ,InDependent Of Other Checked Xception.
#### Agrah Upadhyay 3rd Year B.Tech
<i>--Agrah Upadhyay--</i><br />Final Year B.Tech SCJP,SCWCD,SCBCD <br /> <br /><b>Now since the real test for any choice is having to make the same choice again,knowing full well what it might cost.</b>-Oracle
Joined: Sep 10, 2005
dear mr sandeep,
i would appreciate if you can explain what are the cases in which this thing will work
for e.q. two we already know (Case1) Base class throwing any Exception or no Exception The Derived Class throwing Error
(Case2) Base class throwing any Exception or no Exception The Derived Class throwing RuntimeException
Please Confirm me by posting whether there are any other cases, or this is all.
Following Sandeep's post: To see what is going on, just remove all those Errors and unchecked exceptions (RuntimeException and subclasses thereof) in the above code. They do not take part in any of the decisions as to whether or not overriding is allowed. You will then be left only with Exception.