title: Deserializing Singleton
body: <pre><code>    //Singleton
      public class MainList implements Serializable {
              private static MainList instance = new MainList();
              private MainList() {}
  
              public static MainList getInstance() {
                  return instance;
              }
          }
  
      //Trying to deserialize..
      public MainWindow() {
          //Importing the latest version if it exists in path
          MainList mainListObj = MainList.getInstance();
          try {
              FileInputStream fis = new FileInputStream(path);
              ObjectInputStream oin = new ObjectInputStream(fis);
              mainListObj = (MainList) oin.readObject(); //HERE//////
          }
          catch (Exception exc) {
              return;
          }
      }
  </code></pre>
  
  <p>Singleton-Object of class MainList is serialized &amp; can be found by path.</p>
  
  <p>On the line //HERE/// object successfully deserializing to mainListObj, 
  BUT it's local..</p>
  
  <p>How can I make it global? I think it could be solved by chanching getInstance method..somehow..</p>