How to remove the brackets [ ] from ArrayList#toString()?

后端 未结 11 2364
攒了一身酷
攒了一身酷 2021-01-03 14:09

I have created an Array List in Java that looks something like this:

 public static ArrayList error = new ArrayList<>();

for (int x= 1         


        
11条回答
  •  -上瘾入骨i
    2021-01-03 14:54

    brackets is not a part of your array list, since as you've mentioned it's Integer typed

    ArrayList

    when you print errors using

    System.out.println(errors);
    

    it's just formatting your data, just iterate over the array and print each value separately

提交回复
热议问题