Created
October 11, 2011 08:34
-
-
Save janmarek/1277580 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
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