Why doesn serialization save the value of static variables?
Location: http://www.jguru.com/faq/view.jsp?EID=3354 Created: Dec 22, 1999 Modified: 2000-05-19 18:22:39.565 Author: Tim Rohaly (http://www.jguru.com/guru/viewbio.jsp?EID=10) Variables declared as static members are not considered part of the state of an object because they are shared by all instances of that class. Classes which need to preserve the value of static members during serialization should save and restore these values explicitly using private void readObject(ObjectInputStream) and private void writeObject(ObjectOutputStream).