For one of my projects, I need to define a new exception that extends ProviderMismatchException.
From the javadoc link, you can see that this is an exception:
- extends
IllegalArgumentExceptionwhich - extends
RuntimeExceptionwhich - extends
Exceptionwhich - the extends
Throwable.
All of them define their own static final serialVersionUID, with the exception of the Throwablemodifier that adds it private.
Now, if you implement the Foo interface, then all inherited classes also implement this interface, which means Serializable; however, why do subclasses in the JDK override it for each subclass? What is the danger of not defining it again for inherited classes?
source
share