Why I am not able to throw FileNOtFoundException. As I suppose we cannot throw More exceptions but less is acceptable.
Manfred Klug
Ranch Hand
Joined: Jun 04, 2007
Posts: 377
posted
0
Originally posted by Sweta Pillai:
Why I am not able to throw FileNOtFoundException. As I suppose we cannot throw More exceptions but less is acceptable.
Since the compiler automatically adds the call to the parent constructor. This is the code after compilation:
Chandra Bhatt
Ranch Hand
Joined: Feb 28, 2007
Posts: 1707
posted
0
Both FileNotFoundException and Exception are checked exceptions. While the parent class constructor throws the more specific checked exception, child class must handle or throw that exception or super class of that.