Java initialize variable or array?
<p>This line of code gives the following warning:</p>

<pre><code>    short[] sh = null;

    for (int i = 0, n = b.length; i &lt; n; i++) {
        sh[i] = 0;

    }  
</code></pre>

<p>warning: The variable sh can only be null at this location.</p>

<pre><code>short[] sh;

for (int i = 0, n = b.length; i &lt; n; i++) {
    sh[i] = 0;

} 
</code></pre>

<p>And, this code gives the following warning:</p>

<p>warning: The local variable sh may not have been initialized.</p>
