1

Possible Duplicate:
Why should I bother about serialVersionUID?

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?

Community
  • 1
  • 1
kamaci
  • 72,915
  • 69
  • 228
  • 366

1 Answers1

2

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.

kkishere
  • 154
  • 2
  • 13
dunni
  • 43,386
  • 10
  • 104
  • 99