in the above code you are not serializing a ClassState object but you are serializing a String object, and the String class does implement Serializable interface.
You should keep in mind that it the class whose object you want to serialize must implement Serializable interface and NOT the class in which you are writing the code of Serialization.. In the above code your serialization procedure is written in ClassState which need not implement Serializable.
But in the second code...
you are serializing the object of class MyClass, hence MyClass need to implement the Serializable interface. And also since the whole serialization process is written in a different class SaveState, this class need not implement Serializable interface unless you decide to serialize it's object as well... [ July 29, 2007: Message edited by: Priyam Srivastava ]
"History would be kind to me, for I intend to write it."