List
is an interface. Interfaces cannot be instantiated. Only concrete types can be instantiated.You probably want to use an
ArrayList
, which is an implementation of theList
interface.
List<Product> products = new ArrayList<Product>();
I have the following code:
List<Product> product = new List<Product>();
The error:
Cannot instantiate the type List<Product>