Welcome Message

Hi, welcome to my website. This is a place where you can get all the questions, puzzles, algorithms asked in interviews and their solutions. Feel free to contact me if you have any queries / suggestions and please leave your valuable comments.. Thanks for visiting -Pragya.

November 9, 2009

SerialVersionUID

Serial Version UID

by Frank Kim on Jul.30, 2005, under Eclipse, Java SE

It is simple to make a class serializable, just have it implement the java.io.Serializable interface. However it is not easy to support the serialized form forever.

One issue is the serial version UID. Every serializable class has a unique identification number associated with it. If you do not specify the identification number explicitly by declaring a private static final long field named serialVersionUID, the system automatically generates it by applying a complex deterministic procedure to the class… If you change [the class] in any way … the automatically generated serial version UID changes. If you fail to declare an explicit serial version UID, compatibility will be broken.

No comments: