If I create a singleton object using static final then will it be thread safe? here is the example code?
public class StaticSingleton {
private static final StaticSingleton instance = new StaticSingleton();
private StaticSingleton() {
}
public static StaticSingleton GetInstance() {
return instance;
}
}
Aucun commentaire:
Enregistrer un commentaire