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

why constructor dont have returns type?

9 Answers   IBM,


What is the is a and has a relation ship in oops concept in java?

9 Answers   BearingPoint, TCS,


Explain the difference between call by refrence and call by value?

0 Answers  


When is the finalize() called? What is the purpose of finalization?

0 Answers  


Can we use string in the switch case?

0 Answers  






what are Hostile Applets?

0 Answers  


How do you download stubs from Remote place?

0 Answers  


What are some examples of variable costs?

0 Answers  


How is treeset implemented in java?

0 Answers  


How do you remove an object from an arraylist in java?

0 Answers  


What is lambda programming?

0 Answers  


What is substring of a string?

1 Answers  


Categories