小编che*_*ddy的帖子

如何定义2D列表

在定义2D动态数组时,为什么我不能像这样定义它:

List<List<Integer>> t=new List<List<Integer>();
Run Code Online (Sandbox Code Playgroud)

这样做,我得到一个错误说:

Cannot instantiate the type List<List<Integer>>
Run Code Online (Sandbox Code Playgroud)

我发现这是最好的做法 -

List<List<Integer>> t=new Arraylist<List<Integer>>();  
Run Code Online (Sandbox Code Playgroud)

为什么会如此.有人帮我理解这一点.

java arrays list arraylist

1
推荐指数
1
解决办法
446
查看次数

标签 统计

arraylist ×1

arrays ×1

java ×1

list ×1