开发者

What is the purpose of using serialVersionUID here? [duplicate]

开发者 https://www.devze.com 2023-03-01 07:29 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Why should I bother about serialVer开发者_如何学编程sionUID?
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Why should I bother about serialVer开发者_如何学编程sionUID?

I was examining the Struts2 validation documentation. Even here it is defined:

private static final long serialVersionUID = -7505437345373234225L;

What is the purpose of using serialVersionUID, how to use it(with random numbers?) and what is the purpose of using it at that documentation?


The serialVersionUID is an identifier for serialized objects. If the serialVersionUID of a serialized object doesn't match to the current serialVersionUID of that class, then the deserialization throws an InvalidClassException. The UID is intended to be changed on every structural change of a class.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号