Java Singleton Pattern

  • + 0 comments
    class Singleton{
        private Singleton() {}
        
        public String str;
        
        public static Singleton getSingleInstance() {
            return new Singleton();
        }
    }