Guest User

Untitled

a guest
Apr 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class LazySingleton {
  2. // singleton instance
  3. private static LazySingleton lazySingleton = null;
  4.  
  5. /**
  6. * private constructor so that other classes can't
  7. * instantiate it through constructor
  8. */
  9. private LazySingleton() {
  10. // all initialization steps go here
  11. }
  12.  
  13. public static LazySingleton getInstance() {
  14. if(lazySingleton == null) {
  15. lazySingleton = new LazySingleton();
  16. }
  17. return lazySingleton;
  18. }
  19.  
  20. }
Add Comment
Please, Sign In to add comment