Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LazySingleton {
- // singleton instance
- private static LazySingleton lazySingleton = null;
- /**
- * private constructor so that other classes can't
- * instantiate it through constructor
- */
- private LazySingleton() {
- // all initialization steps go here
- }
- public static LazySingleton getInstance() {
- if(lazySingleton == null) {
- lazySingleton = new LazySingleton();
- }
- return lazySingleton;
- }
- }
Add Comment
Please, Sign In to add comment