Have a singletonTag(s): Language
A singleton is a class that can be instantiated only one time in a JVM. Repeated calls always return the same instance.
public class OnlyOne{
private static OnlyOne one = new OnlyOne();
private OnlyOne(){}
public static OnlyOne getInstance() { return one; }
} OnlyOne myOne = OnlyOne.getInstance();
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com