Why do we need serialVersionUID when extending RuntimeException? Is RuntimeException a serializable class?
public class DataNotFoundException extends RuntimeException {
/**
*
*/
private static final long serialVersionUID = 1;
public DataNotFoundException(String str)
{
super(str);
}
}
RuntimeException
extends Exception
. Exception
extends Throwable
. Throwable
implements Serializable
. So DataNotFoundException
is Serializable
too
Yes, Throwables are Serializable. Serializable means that objects of that class can be converted into a sequence of bytes. Making an exception serializable means it can be transferred across the network between tiers of a distributed application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With