I am having a class which implement Serializable. I Serialize it on JVM. In the process of Serialization, the following occurs
Everytime an object is serialized the
java serialization mechanism automatically computes a hash value. ObjectStreamClass's computeSerialVersionUID() method passes the class name, sorted member names, modifiers, and interfaces to the secure hash algorithm (SHA), which returns a hash value.The serialVersionUID is also called suid.
So when the serilaize object is retrieved , the JVM first evaluates the suid of the serialized class and compares the suid value with the one of the object. If the suid values match then the object is said to be compatible with the class and hence it is de-serialized. If not InvalidClassException exception is thrown.
Now if i Serialize using JVM1 and Deserialize using JVM2, then will the Deserialization work successfully. Also how does Serialization/Deserialization works across network, because when the object is transported across network the JVMs might be different.