Most likely you will get an exception because the serialVersionUID stored in the file does not match the instance in the current version of the class.
By default, Java just throws errors.
If you want to provide a way to read "old versions", you must implement the readObject method .
Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:
private void writeObject(java.io.ObjectOutputStream out) throws IOException private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; private void readObjectNoData() throws ObjectStreamException;
source share