summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Singleton.java
blob: b837e53c37f13a1f76cfaceb08d917c9aa4ba057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class Singleton
{
  private static Singleton instance = null;

  public static Singleton getInstance()
  {
    if (instance == null) {
      instance = new Singleton();
    }
    return instance;
  }

  private Singleton()
  {
  }
}