Clarification regarding static variables
I based my answer on Java Developer�s Journal article �secrets of Java Serialization�. They said �for static variables that are initialized when declared, serialization doesn�t present any special problems�.
I understood it in the sense that static vars ARE serialized, but reality is more complicated.
I did not find any explicit statement that static vars ARE NOT serialized. But description for java.io.Serializable Interface said: �...The readObject method is responsible for reading from the stream and restoring the classes fields. It may call in.defaultReadObject to invoke the default mechanism for restoring the object's non-static and non-transient fields. �
url:
http://java.sun.com/products/jdk/1.2/docs/api/java/io/Serializable.html I think it means that static vars will not be written into the stream � in this sense they are not serialized.
However, when the object�s state is read, static variables are set in their initialized values (which are read, this is my guess, from class code). It means, if you changed value for static variable and then serialized your object, new value will be lost. You have to change writeObject() method of the class to transmit a new value.
To add some useful information: if your class has
1) inner classes;
2) variables referring to them;
you have to declare inner classes serialized also, otherwise you get NotSerializableException.
(I do not think it is in exam objectives

He, looks like to answer questions is more useful for me, than for those, who asked...

(I am laughing at myself)