Hi I want a String list array, which I am trying to create using the statement: List<String> listArray = new List<String>; But the compiler is giving an error for 'new List<String>'. If I use the statement: List<String> listArray = new List; it works fine. But I am not sure if it serves my purpose. Can anyone please clarify?
You cannot create an array with elements of concrete parameterized type. The reason for this is quite technical (because generics in Java are implemented with type erasure, which is incompatible with how arrays work).