Miles
Miles

Reputation: 2527

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?

Upvotes: 6

Views: 801

Answers (1)

user207421
user207421

Reputation: 310860

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

Upvotes: 11

Related Questions