Marco Ehrentreich wrote:If a parent class declares to throw a checked exception, subclasses basically have to throw at least the same checked exceptions to fulfill the contract of the parent class.
The other way round. A child class method does not have to be declared to throw any exception, but it can't be declared to throw a checked exception that the parent class method is not declared to throw.
gives the error
ExceptionMethod() in test.ExceptionChild2 cannot override ExceptionMethod() in test.ExceptionParent; overridden method does not throw org.xml.sax.SAXException at line 23, column 0