title: Singleton with subclassing in java
body: <p>The most common way of implementing a singleton in java is to use a private constructor with a public accessor method of the form --</p>
  
  <pre><code>public class Singleton {
      private static Singleton instance = null;
      private Singleton() {
  
      }
      public static synchronized Singleton getInstance(){
          if (instance == null) {
          instance = new Singleton();         
          } 
          return instance;
      }
  }
  </code></pre>
  
  <p>However, since the constructor is private, it prevents subclassing the singleton. Is there any way in which we can make a singleton which allows subclassing ?</p>