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.
17 lines
386 B
17 lines
386 B
3 years ago
|
package patronSingleton;
|
||
|
|
||
|
public class Singleton1 {
|
||
|
private static Singleton1 instancia = new Singleton1();
|
||
|
|
||
|
//Constructor privado no permite que se genere un constructor por defecto.
|
||
|
private Singleton1() {}
|
||
|
|
||
|
public static Singleton1 getInstancia() {
|
||
|
return instancia;
|
||
|
}
|
||
|
|
||
|
public void mostrarMensaje() {
|
||
|
System.out.println("\nSoy la instancia de Singleton1");
|
||
|
}
|
||
|
}
|