Skip to content

Instantly share code, notes, and snippets.

@janmarek
Created October 11, 2011 08:34
Show Gist options
  • Save janmarek/1277580 to your computer and use it in GitHub Desktop.
Save janmarek/1277580 to your computer and use it in GitHub Desktop.
class Singleton
{
private static Singleton inst;
public Singleton (String password)
{
if (!password.equals("tajne heslo")) {
throw new Exception("Nemuzes vyrobit instanci :-P");
}
}
public Singleton getInstance()
{
if (inst == null) {
inst = new Singleton("tajne heslo");
}
return inst;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment