Can one class in java control object in another class?
<p>Suppose I have a class called <code>Factory</code>.  I intend to have that class publicly accessible so anyone can create and access the <code>factory</code>.  I want the factory to create and distribute <code>widgets</code>.  I only want the factory to be able to create <code>widgets</code>, not anyone in the public program space.  However, I'd like to have a method called <code>distribute()</code> that would give out a <code>widget</code> to the main program.  At that point the main program could access all the public methods of that <code>widget</code>.  It could also give it back to the factory if need be, thereby removing any public access to that object.</p>

<p>If this is possible, how does one accomplish this?</p>
