Initialize ArrayList

后端 未结 4 1589
我寻月下人不归
我寻月下人不归 2021-01-05 03:25

Why I can initialize ArrayList, like this:

ArrayList x = new ArrayList(Arrays.asList(1,2));

But got Error whe

4条回答
  •  梦谈多话
    2021-01-05 04:04

    You have to specify a Long number using literal l or L.

    ArrayList x = new ArrayList(Arrays.asList(1L, 2L));
    

提交回复
热议问题