Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
26
Task/Singleton/Java/singleton-1.java
Normal file
26
Task/Singleton/Java/singleton-1.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class Singleton
|
||||
{
|
||||
private static Singleton myInstance;
|
||||
public static Singleton getInstance()
|
||||
{
|
||||
if (myInstance == null)
|
||||
{
|
||||
synchronized(Singleton.class)
|
||||
{
|
||||
if (myInstance == null)
|
||||
{
|
||||
myInstance = new Singleton();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return myInstance;
|
||||
}
|
||||
|
||||
protected Singleton()
|
||||
{
|
||||
// Constructor code goes here.
|
||||
}
|
||||
|
||||
// Any other methods
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue