E Armitage wrote:But you are checking the value of i and i is NOT static!
Also, what does the class A have to do with any of this?
If t would not have been serialized, then the output would have been 11, default value of "i". But t here is serialized even though it's static, and output is 15.
Doing deserialization via different program ensure JVM does not remember the state of "i"(as you said in your previous post) but still it returns 15, so static "t" is serialized with i as 15.
I included class A to add static "a" in
test class to check that static varaibles are not serialized, but still static "t" is getting serialized.