1

As of now I am clear with the concept of serialization as well as the use of serialVersionUid. I have a doubt and would appreciate you all in helping me understand this scenario. Tried a lots but not getting appropriate help from Google.

1)Sender serializes an Object with a serialVersionUid

2)Receiver deserializes the same Object.

Where does the serialVersionUid come from?I suppose JVM will extract it from the serialized class. So is the receiver expected to have the same class loaded in memory, before deserializing? If then why there would be an Exception because of serialVersionUid mismatch, since the receiver will extract the serialVersionUid from the serialized class. And if this is the case, then why would we require serialVersionUid at all?

log N
  • 925
  • 9
  • 33

0 Answers0