Last active
December 22, 2016 00:24
-
-
Save agustarc/c39ba0b72699f2c56677901e8f251623 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton { | |
private volatile static Singleton instance; | |
private Singeton() {} | |
public static Singleton getInstance() { | |
if (instance == null) { | |
synchronized(Singleton.class) { | |
if (instance == null) { | |
instance == new Singleton(); | |
} | |
} | |
} | |
return instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment