Improve Implementation of Singleton

master
Hammy 4 years ago
parent b1b430dd60
commit 7b5de89dd4

@ -2,12 +2,15 @@ package singleton;
public class SingleObject {
private static final SingleObject instance = new SingleObject();
private static SingleObject instance = new SingleObject();
private SingleObject() {
}
public static SingleObject getInstance() {
if (instance == null) {
instance = new SingleObject();
}
return instance;
}

Loading…
Cancel
Save