Skip to content

Instantly share code, notes, and snippets.

@bensonk
Created September 9, 2011 20:56
Show Gist options
  • Save bensonk/1207311 to your computer and use it in GitHub Desktop.
Save bensonk/1207311 to your computer and use it in GitHub Desktop.
public class SampleSingleton {
private static SampleSingleton instance;
private SampleSingleton() {
instance = this;
}
public static synchronized SampleSingleton getInstance() {
if(instance)
return instance;
else
return new SampleSingleton();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment