Question about declaration and initialization : <p>I have a question about initialization. When we initialize an array with { }, we must do it right after declaration to show compiler which type to use. Why does compiler allow diamond operator do it with 2 statements?</p>

<pre><code>Integer[] array = {2,4,5};
//Integer[] array; array = {2,4,5}; - error
List&lt;Integer&gt; list = new ArrayList&lt;&gt;();
//List&lt;Integer&gt; list; list = new ArrayList&lt;&gt;(); - no error
</code></pre>
