List vs ArrayList

后端 未结 6 566
春和景丽
春和景丽 2021-01-23 20:31
List> listeners = new List>();

Why the line above fails with:

Cannot in

6条回答
  •  攒了一身酷
    2021-01-23 21:05

    List is an interface and you can not create an instance of an interface

    try

    List> listeners = new ArrayList>();
    

提交回复
热议问题