Chiranjeevi Kanthraj wrote:dilan welcome to Ranch
if you want to over ride you can not throw the Subclass of IOException
so you can throw IOException in the sub class Dog for eat method
or if you are not overriding then you have to catch IOException, because Dog class eat method is thows only FileNotFoundException which is Sub class of IOException
When we overriding a method its legal to throw an Exception in overriden method which is a subclass of overriding method's Exception.
but here only problem is I'm calling super.eat();
Finally i think like this..
super.eat(); throws IOException and Dog class eat() method throws FileNotFoundException, So FileNotFoundException cannot fit into the IOException because IOException is the super class.
am I correct ??
Regards,
Dilan Alex.