miscellaneous
Serializable and the significance of serialVersionUID.
Serializable is a marker interface that tells the JVM that an object can be converted into a bitstream.
serialVersionUID:
- A unique ID used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible.
- If the receiver has loaded a class for the object that has a different
serialVersionUIDthan the sender, then deserialization will result in anInvalidClassException. - Best Practice: Always define a static final long
serialVersionUIDto ensure cross-version compatibility.