What is serialVersionUID and what is its need?
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 |
What are the advantages of exception handling?
What is static import?
What is a nested list?
Why should we use singleton pattern instead of static class?
What is the difference between keyword and identifier?
what is run time polymorphism
String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?
What is final access modifier in java?
What is an anonymous class in java?
What is type inference in java8?
Is java se open source?
How do weakhashmap works?