Java List vs ArrayList

前端 未结 7 1733
有刺的猬
有刺的猬 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条回答
  • 2020-12-07 02:03

    Yes. Because List is an Interface and in Java you cannot instantiate an Interface. You can only instantiate a class.

    ArrayList is a class that's implementing List<> that's why you can instantiate it. :)

    0 讨论(0)
提交回复
热议问题