/*

 * MySingletonUserWKey.java

 *

 * Disclaimer:

 * ZebraSoft.com disclaims all warrantees with regard to documents/programs, including

 * all implied warranties. In no event shall ZebraSoft.com be liable for indirect or

 * consequential damages or any damages whatsoever resulting from loss of use, data or

 * profits arising out of the use of documents/programs.

 *

 * All content included on this site, such as text, graphics, logos, button icons,

 * images, audio clips, video clips, digital downloads, programs, data compilations,

 * and software, is the property of ZebraSoft.com or its content suppliers and

 * protected by United States and international copyright laws.

 *

 * This site or any portion of this site may not be reproduced, duplicated,

 * copied, sold, resold, visited, or otherwise exploited for any commercial

 * purpose without express written consent of ZebraSoft.com.

 */

 

package creational_patterns.my_singleton_w_key;

 

/**

 *

 * @author Sam Eldin

 */

import java.lang.*;

import java.util.*;

import java.io.*;

 

 

 

public class MySingletonUserWKey implements Key {

   

    /** Creates a new instance of MySingletonUserWKey */

    public MySingletonUserWKey() {

         setKey();

         MySingletonWKey    mySingletonHandler_1 = getInstance();

         System.out.println("First call to MySingletonWKey");

         System.out.println(" ====================");

         MySingletonWKey    mySingletonHandler_2 = getInstance();

         System.out.println(" Second call to MySingletonWKey");

         System.out.println(" ====================");

         setKey();

         MySingletonWKey    mySingletonHandler_3 = getInstance();

         System.out.println(" Second call to MySingletonWKey");

    }

    /*

     *

     */

    public void setKey(){

        MySingletonWKey.key = Key.keyValue;

    } 

    /**

     *

     *

     */

     public MySingletonWKey getInstance(){

         return(MySingletonWKey.makeInstance());

     }

    /**

     *

     */

     public static void main (String[] args)

    {

        MySingletonUserWKey mySingletonUserWKeyHandle = new MySingletonUserWKey();

    }

    

   

}



Back to Command