serialVersionUID
serialVersionUID is a static final long primitive data type in Java. It is used during the serialization and deserialization process. When an object is serialized, its serialVersionUID is written to the serialization stream. When the object is deserialized, the JVM compares the serialVersionUID of the deserialized object with the serialVersionUID of the class definition in the current JVM. If the two serialVersionUID values do not match, a java.io.InvalidClassException is thrown.
The primary purpose of serialVersionUID is to ensure version compatibility between serialized data and the class
It is a best practice to explicitly declare a serialVersionUID for all serializable classes. This can be