I am reading the chapter on Serialization in Effective Java.
Who calls the readObject() and writeObject()? Why are these methods declared private ?
The readObject and writeObject are called by the Object(Input/Output)Stream class(es).
These methods are (and must be) declared private (when implementing your own), proving/indicating that neither method is inherited and overridden or overloaded by the implementation. The trick here is that the JVM automatically checks to see if either method is declared during the corresponding method call. Note that the JVM can call private methods of your class whenever it wants but no other objects can. Thus, the integrity of the class is maintained and the serialization protocol can continue to work as normal.
And regarding the transient int, it's just taking control over serialization of the entire object serialization as such. However, note that technically it is not even necessary to invoke defaultWriteObject(), if all fields are transient. But i think it is still recommended to invoke it for flexiblility purposes, so that later you can introduce non-transient members in your class, preserving compatibility.