Commented singleton example.
This commit is contained in:
@ -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