ВопросJuniorИП Ганус Александр Андреевич25 просмотров

public class Singleton { private static final Singleton instance; public Singleton() { } public Singleton getInstance() { if (instance != null) { synchronized (instance) { if (instance == null) { instance = new Singleton(); } } } return instance; } }