The constructor is not called for your 'Serializable' class. If the JVM must reload
the class, however, the statics will revert to their initialized values. Otherwise, if
you serialize and then immediately deserialize, static values are untouched.
When recreating an instance from a serialized object, the constructor with no parameters is used. Because you did not specify this constructor, the compiler creates one for you.
EDIT: I tried my own test (creating a constructor with no parameters) and found I was wrong. Looks like it's back to reading the book for me :-)
Joined: Feb 18, 2010
Where can I find an example program that demonstrates static variables reverting to their original values after class is de-serialized. Or better yet, how can I modify the code I posted to perform this action. Please guide.