Created
February 17, 2014 01:39
-
-
Save DavidTPate/9043249 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 EagerStaticSingleton { | |
private static EagerStaticSingleton instance = null; | |
private EagerStaticSingleton() { } | |
static { | |
try { | |
instance = new EagerStaticSingleton(); | |
} catch (Exception e) { | |
// Do something | |
} | |
} | |
public static EagerStaticSingleton getInstance() { | |
return instance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment