You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
478 B
18 lines
478 B
package patronSingleton;
|
|
|
|
public class Singleton {
|
|
|
|
private static Singleton instancia = null;
|
|
|
|
private Singleton() {}
|
|
|
|
public static Singleton getSingleton() {
|
|
if (instancia==null) {
|
|
System.out.println("Se genero una instancia de Singleton");
|
|
instancia = new Singleton();
|
|
}else {
|
|
System.out.println("No se puede generar otra instancia de Singleton");
|
|
}
|
|
return instancia;
|
|
}
|
|
}
|
|
|