Singletonpublic class Singleton extends Object An example of a Singleton implementation in Java.
The Singleton design pattern is described in GOF; the idea is to ensure
that only one instance of the class will exist in a given application. |
Fields Summary |
---|
private static Singleton | singleton |
Constructors Summary |
---|
private Singleton()A private Constructor prevents any other class from instantiating.
|
Methods Summary |
---|
public java.lang.String | demoMethod()A simple demo method
return "demo";
| public static Singleton | getInstance()Static 'instance' method
return singleton;
|
|