What is serialVersionUID and what is its need?



What is serialVersionUID and what is its need?..

Answer / javamasque

The serial version UID is metadata about the serializable object, it is hash code for the serializable object. It contains information about class name, field name, field type, implemented interfaces and super classes. For each modification to serializable object, we have to update serial version UID explicitly. If we do not provide any serial version UID, JVM’s default serialization mechanism generates serial version UID for the object at runtime.

During deserialization, JVM matches the serial version UID from object stream with the serializable object which will receive the stream data. If there is a mismatch in serial version UID, JVM throws InvalidClassException

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More Core Java Interview Questions

What are some examples of variable costs?

0 Answers  


as we know a static method could access static data and static method only. then how could main method call the object of aclass which is not static and other non static data

1 Answers  


Is java an open source?

0 Answers  


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

0 Answers  


What are the basic concepts of OOPS in java?

0 Answers   Axtria, ITC Indian Tobacco Company,






what is finalmethod & final variable with example?

6 Answers   HP,


what is meant wrapper classes?

0 Answers  


how can u create the object with out new operator

2 Answers  


What is the format of Inner Class after it compiled?

1 Answers  


Is string is a keyword in java?

0 Answers  


How would overload a function based on return type?

0 Answers   Genpact,


what is the difference between String s="hello"; and String s=new String("hello");?

3 Answers  


Categories