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.
16 lines
386 B
16 lines
386 B
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");
|
|
}
|
|
}
|
|
|