Uses of readObject/writeObject in Serialization

Custom readObject methods are also useful when you need to initialize transient (non-serialized) fields after the object has been deserialized.


BTW, check out Effective Java, Chapter 11 (I’m not sure what the chapter/item number is in the 2nd ed.). It’s an excellent read on serialization.

Leave a Comment