title: create only one instance of a class from outside
body: <p>I have a class <code>Class1</code>. I want to have only one instance of this class. </p>
  
  <p>Now I can do it via Singleton pattern but what I have seen is that in this pattern the class itself manages its own instance; for e.g:</p>
  
  <pre><code>public class Class1 {
     private static Class1 INSTANCE;
  
     // some instance variables...
  
     // Private Constructor
     private Class1() {...}
  
     public static Class1 getInstance() {
        synchronized(INSTANCE) {
           if (INSTANCE == null) {
              INSTANCE = new Class1();
           }
        }
        return INSTANCE;
     }
  
     public void class1Method1() {
        ...
     }
  } 
  </code></pre>
  
  <p>and you use its method by </p>
  
  <pre><code>Class1.getInstance().class1Method1();
  </code></pre>
  
  <p>But in my case another class <code>Class2</code> needs to create the single instance of class <code>Class1</code>. How can I do that?</p>
  
  <p>Thanks</p>