001package headfirst.singleton.classic; 002 003// NOTE: This is not thread safe! 004 005public class Singleton { 006 private static Singleton uniqueInstance; 007 008 // other useful instance variables here 009 010 private Singleton() {} 011 012 public static Singleton getInstance() { 013 if (uniqueInstance == null) { 014 uniqueInstance = new Singleton(); 015 } 016 return uniqueInstance; 017 } 018 019 // other useful methods here 020}