/** * Author: Josiah Yoder et al. * Class: SE2811-011 * Date: 1/6/14 7:50 AM * Lesson: Week 4, Day 1 */ package example4_1; public class Singleton { // eager initialization // static Singleton uniqueInstance = new Singleton(); // lazy initialization static Singleton uniqueInstance = null; private Singleton() { /* Construct stuff here */ } public static Singleton getInstance() { if(null == uniqueInstance) { uniqueInstance = new Singleton(); } return uniqueInstance; } }