Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why doesn serialization save the value of static variables?

0
Posted

Why doesn serialization save the value of static variables?

0

Location: http://www.jguru.com/faq/view.jsp?EID=3354 Created: Dec 22, 1999 Modified: 2000-05-19 18:22:39.565 Author: Tim Rohaly (http://www.jguru.com/guru/viewbio.jsp?EID=10) Variables declared as static members are not considered part of the state of an object because they are shared by all instances of that class. Classes which need to preserve the value of static members during serialization should save and restore these values explicitly using private void readObject(ObjectInputStream) and private void writeObject(ObjectOutputStream).

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.