Hi Chandra,
List<String> lst = new ArrayList<String>[10]; //compiler error, WHY?
Correction to your question:
List<String>[] lst = new ArrayList<String>[10]; //compiler error, WHY?
Here the Thing is Array's will remebers the type of element at runtime. Thats why They can throw ArrayStoreExxption when ever any mismatch found.
Like
Animal [] a = new Dog[10];
a[0] =new Cat(); // This Throws ArrayStoreException why becuase Arrays will rememer the type at runtime.
But
In case genric arrays. Array behavior will be compromised. Which is restricted by compiler. In case of genric arrays "ArrayStoreException" can't be thrown bec'ze of type erasure for generics. Thats why the creation of genric arrays was restricted at compile time
[ April 24, 2007: Message edited by: Srinivasan thoyyeti ]