while doing serialization of static variables why after writing to files it gives us latest initialized values of static variables .Does it opens a file again and writes to the file.
Anyone help me follow the code below
Static variables don't get serialized because static variables are shared by all instances. What would happen if you serialized static variables, and you deserialized several instances of the same class that were serialized when a given static variable happened to have different values?
That should clear your doubts, let me know if that's not the case.
All code in my posts, unless a source is explicitly mentioned, is my own.