title: How come the static variable is Serialized?
body: <pre><code>public class MySerializable implements Serializable{
  
      private int x=10;
      private static int y = 15;
      public static void main(String...args){
          AnotherClass a = new AnotherClass();
          AnotherClass b;
          //Serialize
          try {
              FileOutputStream fout = new FileOutputStream("MyFile.ser");
              ObjectOutputStream Oout = new ObjectOutputStream(fout);
              Oout.writeObject(a);
              System.out.println( a.toString());
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          //De-serialize
          try {
              FileInputStream fis = new FileInputStream("MyFile.ser");
              ObjectInputStream  Oin = new ObjectInputStream (fis); 
              b = (AnotherClass) Oin.readObject();
              System.out.println( b.toString());
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }catch (ClassNotFoundException e){
              e.printStackTrace();
          }
  
      }
  }
  
  class AnotherClass  implements Serializable{  
  
      transient int x = 8;  
      static int y = 9;  
  
      @Override  
      public String toString() {  
          return "x : " + x + ", y :" + y;  
      }  
  }
  </code></pre>
  
  <p>Can you please tell me how the static variable is serialized  ??</p>