Sharing an object through several classes
<p>I need to share 1 instance between several classes.
The Connect class has methods to create a URL and to download data, and the ui is the interface (swing form) through which I get the data to build the url (dates theat comprise the url).</p>

<p>What's the best way to do it?</p>

<p>Thought of:</p>

<p>1) Making it global by:</p>

<pre><code>public class Global {

public static  Connect c;
}
</code></pre>

<p>2) Making the instance in main(), and passing it through objects.</p>

<pre><code>public static void main(String[] args) throws IOException {

           Connect c = new Connect();   // get url to download from
           ui form = new ui(c);         // the form to get data from 
.
.
.
</code></pre>

<p>What seems more reasonable, if any?</p>

<p>Thank you.</p>
