posted 13 years ago
I assume you mean "a" holds a reference to an ObjectOutputStream, not a FileOutputStream. I also assume you mean serialize, because writeObject serializes an object, not deserializes.
ObjectOutputStream uses reflective code to save the class of an object, and then all its fields. It just reads all the fields and stores them in some sort of format. If you have specific questions, you could look at the source code for ObjectOutputStream.