How can an Integer be added to a String ArrayList?
<pre><code>List list = new ArrayList&lt;String&gt;() ;
list.add(1) ;
Integer hello = (Integer) list.get(0) ;
System.out.println(hello);
</code></pre>

<p>The above code has a reference of type <strong>List</strong> referring to an instance of <strong>ArrayList</strong> of type <strong>String</strong>. When the line <code>list.add(1)</code> is executed, isn't the 1 added to the ArrayList (of type String) ? If yes, then why is this allowed?</p>
