Java List vs ArrayList

前端 未结 7 1753
有刺的猬
有刺的猬 2020-12-07 01:14

As a C++ oldtimer I have managed to solve my problem but I can not wrap my head around the underlying Java mechanisms here:

Vector x = new Vec         


        
      
      
      
7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 01:57

    List isn't class it's an Interface and you can't instantiate the interface object.

    ArrayList is the class which was implement the List interface so can able to instantiate the ArrayList object and assign to the List object

提交回复
热议问题