Hi, I came to know that " The identifier that is part of all classes is maintained in a field called serialVersionUID." But I am not able to access this field directly (say through a print statement, like System.out.println(serialVersionUID); ). So where is this value stored ? Also, i didnt find it in the class file when i opened it with decompiler.
According to the documentation I found, if you do not define a static final long serialVersionUID in your Serializable class, the ObjectOutputStream will compute one. The purpose being to avoid incompatible versions of a class being created by object serialization. Bill
I got a similar problem with this (but with an other flavor), the non static inner classes can not be serializated (as long the content class is not serializable). The explication was that a non static inner can not have a static member and if the content class is serializable its serialUID member can be access by the inner class.
I hope I was right ? What you think ?
SCJP, SCJD, SCWCD, OCPJBCD
Joined: Nov 05, 2004
Originally posted by Mihai Radulescu: Hallo The explication was that a non static inner can not have a static member.
Just one sidenote. Non static inner class can have static final variables (as they are constants). For ex.