It is important when you serialize and de-serialize the same class using different VMs or on different machines. The UID is used to check if the class you are trying to de-serialize is the really the one you think it is, so if your class in your code has one UID, and the class that was serialized has a different one, the de-serialization will fail.
A class without a UID will be given one automatically by the JVM, but there is no guarantee that different JVMs will give the same UID to the same class.
Read the javadoc of the Serializable interface for more details.
Can it be any number?
Ideally it should be some number unique to that particular version of your class (like a hash), if you make changes to your class that affect serialized fields (non-transient
), the UID needs to change. I think Eclipse can generate a UID automatically for you.