Java singleton pattern
D00msDay
0 Likes0 Commentsjavaclass Singleton { private static instance; private Singleton() { } public static Singleton getInstance { if (instance == null) { instance = new Singleton(); } return instance; } }
class Singleton {
private static instance;
private Singleton() {
}
public static Singleton getInstance {
if (instance == null) {
instance = new Singleton();
}
return instance;
}
}