shanta raja wrote:When JVM tries to compare incoming serialized objects and does not find a corresponding getSerialVersionUID method defined in the class declaration, then it throws an error.
None of my JVMs do.
What I mean to say is if you write your own serialVersionUID, then you need to override the getSerialVersionUID method, just like the equals and hashcode methods.
I don't believe that's true: the following works just fine (lifted from Wikipedia, I think):
(Line 39 is commented out because I changed the serialVersionUID from 42L to 43L and tried to read in the previously-serialized object, it failed because the serialVersionUID wasn't the same as when I serialized it originally.)
Is there something you're reading or studying that makes you believe you need this method that isn't defined in the Serializable interface?