001package headfirst.singleton.subclass; 002 003public class Singleton { 004 protected static Singleton uniqueInstance; 005 006 // other useful instance variables here 007 008 protected Singleton() {} 009 010 public static synchronized Singleton getInstance() { 011 if (uniqueInstance == null) { 012 uniqueInstance = new Singleton(); 013 } 014 return uniqueInstance; 015 } 016 017 // other useful methods here 018}