The overriding method must NOT throw checked exceptions that are new or broader than those declared by the overridden method. e.g. a method that declares a FileNotFoundException cannot be overridden by a method that declares a SQLException, Exception or any other non-runtime exception unless it’s a subclass of FileNotFoundException.
As to why this is the case, an instance of a subclass should be able to be used anywhere an instance of a superclass is expected. (See: Liskov Substitution Principle). Client code might not even know (and should never care) that its dealing with an instance of a particular subclass, so how can it deal with an exception that it doesn't even know could be thrown?
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Come have lunch with me Arthur. Adventure will follow. This tiny ad: