This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
When you want to do only a part of the serialisation/deserialisation yourself you must invoke the defaultReadObject() & defaultWriteObject().
What defaultReadObject() & defaultWriteObject() does?
1. It's not compulsory to invoke defaultReadObject() & defaultWriteObject(). 2. both methods are called to carry out the serialization/deserialization process which would occur if you had not implemented read/writeObject.
Also remember, the order in which you call defaultXXXObject() inside XXXObject() is also very important.
Where I have seen that discussed is in the case where you want to write out field values that are non-serializable so you override the writeObject() and readObject() methods. Within your overridden method you still have to account for serializing the serializable part of the object/object graph, so you should imbed a defaultWriteObject() / defaultReadObject() to do the normal part of serialization/deserialization. At least that is what I thought it was.
SCJP - 86% - June 11, 2009