mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 08:18:23 +00:00
Commented singleton example.
This commit is contained in:
1 parent
ed81bcf69b
commit
54b414acb1
2 files changed
+11
No files matched your search
@@ -1,5 +1,11 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Singleton pattern ensures that the class (IvoryTower) can have only
|
||||||
|
* one existing instance and provides global access to that instance.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Singleton class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class IvoryTower {
|
public class IvoryTower {
|
||||||
|
|
||||||
private static IvoryTower instance = new IvoryTower();
|
private static IvoryTower instance = new IvoryTower();
|
||||||
|
|||||||
Reference in new issue
Block a user