Home > Back-end >  Java serialization version number
Java serialization version number

Time:02-07

A class implements the Serializable interface after writing a fixed serialization version number private static final long serialVersionUID serialVersionUID the variable name can change to other? Where are the variable name, private should not be inherited

CodePudding user response:

Two generation strategy, is a fixed 1 l, one is randomly generated a long not to repeat the data (which is actually using JDK tools to generate)

CodePudding user response:

SerialVersionUID name cannot be modified into other, is the core in the package specification may dictate the name inside,

CodePudding user response:

Can, because can not define this variable, the system will automatically generated according to compile a class a comparison with serislVersionUID
If don't want to compile to differentiate version, will himself according to define the variable
This variable is used to determine the deserialization, target and serialization version version of the class, if the same can be deserialized, otherwise, the exception
  • Related