Suppose a SuperClass America and two of its SubClasses SouthAmerica and NorthAmerica
Case 1
For Arrays:
America[] am = new SouthAmerica[10]; //why no compiler error
am[0]= new NorthAmerica(); //ArrayStoreException at RunTime
Case 2
While in Genrics:
ArrayList<America> ame = new ArrayList<SouthAmerica>(); //this does not compile
My question is not why case 2 does not compile but my question is why case 1 compiles.I mean what else can be do this base Array Type and Sub Array Object??