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 widening and narrowing in java? Discuss with an example.
Is a method a procedure?
how do I create a runnable with inheritance? : Java thread
When is an object subject to garbage collection?
explain different ways of using thread? : Java thread
How we can execute any code even before main method?
Can we create a class inside a class in java?
How can you add and remove nodes in jtree?
What is difference between protected and private?
What is independent and dependent variables in research?
What is singleton class in ruby?
Is 0 an even number?
What are operators and its types?
Explain the hierarchy of java exception classes?
What is meant by JVM? Is JVM platform independent or not?