Search code examples
javaserializationtransient

Java Serialization with Transient Field


With Java Serialization, I understand that when a field is marked as transient, it is not serialized. So when the object is deserialized, what happens to the fields that were set to transient? Do they get set to the values defined in the constructor?


Solution

  • They get set to the default value for the type: zero, false, or null.