Java List vs ArrayList

前端 未结 7 1762
有刺的猬
有刺的猬 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 01:48

    List is an interface, you cannot initialize it. ArrayList implements List, so you can assign an ArrayList instance to a List variable.

提交回复
热议问题