I was reading java docs
https://docs.oracle.com/javase/tutorial/java/generics/restrictions.html#createArrays
It says
"You cannot create arrays of parameterized types"
So I'm able to create below array of ArrayList using below code
ArrayList<Integer>[] al = new ArrayList[n];
But why its showing error on below code. Its also an array of List
s. Why its showing compile time error ?
List<Integer>[] arrayOfLists = new List<Integer>[2];
WHat's parameterized type here actually .? I think its Integer
, but its present in both types of arrays.