Skip to content

Instantly share code, notes, and snippets.

@TonnyXu
Created March 1, 2010 07:58
Show Gist options
  • Save TonnyXu/318182 to your computer and use it in GitHub Desktop.
Save TonnyXu/318182 to your computer and use it in GitHub Desktop.
public final class Singleton3{
private static class Handler{
private static final Singleton3 INSTANCE = new Singleton3();
}
private Singleton3(){
if (null != Handler.INSTANCE){
throw new IllegalArgumentException("Already instantiated.");
}
}
public static final Singleton3 getInstance(){
return Handler.INSTANCE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment