title: how arraylist is heterogeneous if it internally uses Object[] Array
body: <p>arraylist internally uses Object[] Array which is homogeneous then how arraylist is heterogeneous</p>
  
  <p>The following throws an exception when running:</p>
  
  <pre><code>Object[] array = new String[3];
  array[0] = "a";
  array[1] = 1;   // throws java.lang.ArrayStoreException
  </code></pre>
  
  <p>unlike the following which compiles and runs without problem</p>
  
  <pre><code>ArrayList list = new ArrayList&lt;String&gt;();
  list.add("a");
  list.add(1);    // works
  list.add(new Object());  // works
  </code></pre>