Why assign a new ArrayList to a List variable?
<p>I am new to java and when I go through the code of many examples on net I see people declaring the variable for an <code>ArrayList</code> as simply <code>List</code> in almost all the cases.</p>

<pre><code>List&lt;String&gt; myList = new ArrayList&lt;String&gt;();
</code></pre>

<p>I don't understand if there is some specific advantage of doing this. Why can't it be an <code>ArrayList</code> itself, like so:</p>

<pre><code>ArrayList&lt;String&gt; myList = new ArrayList&lt;String&gt;();
</code></pre>
