[Solved] Add an array to an array in Java [closed]


You can use List<List<String>> instead for example :

List<List<String>> arrList = new ArrayList<>();

for (int i = 0; i < 5; i++) {
    List<String> arr = new ArrayList<>();
    arr.add("a" + i);
    arr.add("b" + i);
    arr.add("c" + i);
    arrList.add(arr);
}
System.out.println(arrList);

Output

[[a0, b0, c0], [a1, b1, c1], [a2, b2, c2], [a3, b3, c3], [a4, b4, c4]]

4

solved Add an array to an array in Java [closed]