Singleton


Interesante articulo, sobre singletons, en la parte de certificacion de JavaHispano.

Lo he añadido a mi repo git.

public class Singleton {

	private static class SingletonLazyHolder {
		private static final Singleton INSTANCE = new Singleton();
	}

	private Singleton() {
	}

	public static Singleton getInstance() {
		return SingletonLazyHolder.INSTANCE;
	}

	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
	}
}
Anuncios
Singleton