Write a class inventoryhandler to inherit a parent class defaulthandler. The method defined in the parent class throws a saxexception: Public void fatalError (saxparserexception SPE) throws saxexception
This method is implemented in the subclass, but no exception is thrown during definition: Public void fatalError (saxparserexception SPE)
ProgramIt is strange that compilation can be performed normally.
___________________________________________________________________________
The subclass inherits the parent class. The exception thrown by the inherited method can be smaller than that thrown by the parent class, and cannot be greater than that thrown by the parent class, that is, the exception thrown by the subclass method cannot be the parent class that the corresponding method of the parent class throws, but it can be a subclass. Of course, the exception is not thrown, so the program is compiled correctly, the parent class method does not throw exceptions, and the corresponding subclass method cannot throw.
Solve the problem.