Creating arraylist of arrays

后端 未结 5 1920
误落风尘
误落风尘 2021-01-13 03:34

I\'m trying to create an array list of string arrays. When I am done, I want the array list to look like this:

[0,0], [0,1], [1,0], [1,1,]

5条回答
  •  -上瘾入骨i
    2021-01-13 04:26

    You have just one item (t2) and each time you add it to the ArrayList . actually the reference of t2 is going to be saved in ArrayList so when you change the t2 value all of references in the ArrayList take effect.

提交回复
热议问题