Cannot instantiate the type List<Product>

来源:互联网 发布:全国中小学数据库 编辑:程序博客网 时间:2024/06/05 02:25

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 the List 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>

原创粉丝点击