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