When will I get an arraystoreexception and a classcastexception with respect to generics?
<p>My understanding is that you get an <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayStoreException.html" rel="nofollow">ArrayStoreException</a> when you try to insert an object of incompatible type. </p>

<pre><code>Object[] array = new String[1];
array[0] = 1; 
</code></pre>

<p>Can someone explain, with an example, when will I get an <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayStoreException.html" rel="nofollow">ArrayStoreException</a> and when will I get a <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ClassCastException.html" rel="nofollow">ClassCastException</a> ? </p>
