Java Non-Static Field Defaults?
<p>I recently came across a piece of code:</p>

<pre><code>public class SomeClass
{
    private Logger logger = LoggerFactory.getInstance().getLogger(SomeClass.class);
    private int whatever;

    // .. Rest of the class definition
}
</code></pre>

<p>And was blown away! This code compiles and runs beautifully!  I've only seen this kind of assignment performed on class variables (statics).  I was under the impression that in order to assign values to instance variables, one had to do so inside of a method. Wrong!</p>

<p>My question: <strong>is this a way of overriding the Java default value for types?</strong> For instance, in the example above, the <code>1ogger</code> field would ordinarily be assigned a value of <code>null</code> until assgined a value by a constructor/setter. Other types, such as primitives, all have their own built-in defaults, such as <code>booleans</code> which are by default <code>false</code>.</p>

<p>Is this just Java's way of letting you override built-in defaults? Otherwise, what the heck is this and why is it compiling?!?</p>

<p>Thanks in advance!</p>
