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

How to perform Singleton of the java class object on multi JVM?

2 Answers  


What are the rules for naming an array?

0 Answers  


What does || || mean in math?

0 Answers  


i don't want fullforms of JDK an JVM i want definitions for them

2 Answers  


Can a class with private constructor be extended?

0 Answers  






What are the various access specifiers in java?

0 Answers  


How do you do descending order in java?

0 Answers  


What is used of static keyword in java?

0 Answers   Cyient,


Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)

0 Answers   Amazon,


Can a serialized object be transferred via network?

0 Answers  


List out five keywords related to exception handling ?

0 Answers  


Write a program to print fibonacci series

0 Answers  


Categories