What does this statement with List and ArrayList mean?

后端 未结 5 1731
忘了有多久
忘了有多久 2021-01-14 08:56

I am reading the Drools Planner examples and I came across code like this a lot:

List columnList = new ArrayList(n);
5条回答
  •  梦谈多话
    2021-01-14 09:22

    List is actually an interface and therefore can not be instantiated. So in order to use list, you must create an object of its implementation, for example: ArrayList. Read http://docs.oracle.com/javase/1.4.2/docs/api/java/util/List.html for more information

提交回复
热议问题