title: static member serialization
body: <p>I read that 'Serialization Is Not for Static Elements' - but a simple example below tells me otherwise.</p>
  
  <pre><code>class superparent implements Serializable {
      int data = 0;
  
      public superparent(int data) {
          this.data = data;
      }
  
      public int getdata() {
          return data;
      }
  }
  
  public class statichost implements Serializable {
      int member = 0;
      public static superparent s = new superparent(20);
  
      public statichost(int data) {
          this.member = data;
      }
  
      public static void main(String[] args) {
          statichost c = new statichost(6);
          try {
              FileOutputStream fs = new FileOutputStream("testSer.ser");
              ObjectOutputStream os = new ObjectOutputStream(fs);
              os.writeObject(c);
              os.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          try {
              FileInputStream fis = new FileInputStream("testSer.ser");
              ObjectInputStream ois = new ObjectInputStream(fis);
              c = (statichost) ois.readObject();
              ois.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
          System.out.println("after: contained data is " + c.s.getdata());
      }
  }
  </code></pre>
  
  <p>The output prints 20 when I would have expect 0 as per the statement above.
  Am I missing something?</p>