Should members be initialized in the class or the constructor?
<p>Is it a good practice to initialize variables, specially object references at class level?
Please consider the following examples;</p>

<pre><code>public class MyClass {

    private static MyObject myObject;

    public static void main(String[] args) {

        myObject = new MyObject();
    }
}
</code></pre>

<p>or</p>

<pre><code>public class MyClass {

    private MyObject myObject = new MyObject();

    public static void main(String[] args) {

          // Other code
    }
}
</code></pre>

<p>Which way is best? Please guide me about the pros and cons of both.</p>

<p>Regards.</p>
