This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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).