List vs ArrayList

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

Why the line above fails with:

Cannot in

6条回答
  •  闹比i
    闹比i (楼主)
    2021-01-23 20:58

    The List is an interface so you can't instantiate it where as ArrayList is a concrete class which is an implementation of List.

提交回复
热议问题