Initializing on declaration vs initializing in constructors
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3918578/should-i-initialize-variable-within-constructor-or-outside-constructor">Should I initialize variable within constructor or outside constructor</a>  </p>
</blockquote>



<p>I was wondering, which is a better practice and why. Should I initialize class fields upon declaration, or should I do it in the constructor? Given that it's a simple one-line initialization.</p>

<pre><code>class Dude
{
    String name = "El duderino";

    Dude() {
        // irrelevant code
    }
}
</code></pre>

<p>vs.</p>

<pre><code>class Dude
{
    String name;

    Dude() {
        name = "El duderino";

        // irrelevant code
    }
}
</code></pre>

<p><strong>Edit:</strong> I am aware of the situations where one of the styles would be preferred over the other like in the case of executing initializer code that might throw an exception. What I'm talking about here are cases when both styles are absolutely equivalent. Both ways would accomplish the same task. Which should I use then?</p>
