What is serialVersionUID and what is its need?
Answer Posted / 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 View All Answers
What is the difference between stored procedure & function?
Can we call a non-static method from inside a static method?
How is abstraction implemented in java ?
What is the difference between iterator and enumeration ?
How do you define a parameter?
What is difference between string and new string?
Describe the term diamond problem.
What does java ide mean?
How strings are created in java?
Can a variable be local and static at the same time?
Can a class be a super class and a sub-class at the same time? Give example.
What does the exclamation mark mean in java?
Can you run java program without main method?
hr interview how many minutes asking question
Is hashset ordered java?