Why should initialize list in Java : <p>If I use the below code</p>

<pre><code>List&lt;String&gt; listOfStrings=new ArrayList&lt;&gt;();
listOfStrings.add("first string");
</code></pre>

<p>or the following code</p>

<pre><code>List&lt;String&gt; listOfStrings;
listOfStrings.add("first string");
</code></pre>

<p>to create a Java list, both the codes get compiled successfully and give same output on iterating the list. So what is the relevance of initializing the list</p>
