What is the name of the field that identifies a serializable class's version?
Answer
serialVersionUID
Answer
serialVersionUID
The field that identifies a serializable Java class’s version is `serialVersionUID`.
It is a `static final long` field used by Java Object Serialization to check whether the class that wrote a serialized stream is compatible with the class now reading it. A declaration commonly looks like `private static final long serialVersionUID = 1L;`. During deserialization, a mismatch can cause `InvalidClassException`.
Developers can declare the value explicitly, which makes the intended serialization identity stable as the class evolves. If no field is declared, the serialization runtime calculates a default identifier from details of the class, including its name, interfaces, methods, and fields. Small source or compiler changes can therefore alter the computed value unexpectedly.
The name is easy to misremember as `serialUID` or `versionID`, but the canonical field is exactly `serialVersionUID`, with a capital V and UID suffix. The identifier does not automatically migrate arbitrary incompatible data; developers must preserve compatible class structure or provide custom serialization logic when formats change.
Source: Wikipedia · fact-checked Aug. 2026