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 is boolean strategy?

0 Answers  


Is java programming easy?

0 Answers  


Explain the scope of a variable.

0 Answers   TCS,


Why string is immutable or final in java

0 Answers  


Is binary a low level language?

0 Answers  






What do you mean by buffering?

0 Answers  


Why main method is called first in java?

0 Answers  


What is unicode in java?

0 Answers  


What are the properties of thread?

0 Answers  


why String class is immutable.

5 Answers   iGate,


what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread

0 Answers  


byte a=5; byte b=5; byte c=a+b; System.out.println(c); whats the o/p?

7 Answers   NIIT, Wipro,


Categories