Prove this: "Serialization Is Not for Statics" in java?
Prove this: "Serialization Is Not for Statics" in java?With an example.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Mar 27, 2014, 5:09 PM
// Animal.java
The value of the static field, numberOfAnimals, has changed from 1 to 5 because we set it to 5 after we'd serialized the object.
As the original value of 1 has not been restored, this proves that static fields are not serialized.
Abhijeet SinghPosted Mar 28, 2014, 1:45 PM