I need to print in Java an ArrayList - but without the square brackets [ ] - how can I do it? The output MUST be without the square brackets [ ];
For example I have this code:
ArrayList<Integer> n = new ArrayList<>();
n.add(4);
n.add(5);
n.add(434);
n.add((int) 9.5);
System.out.println(n);
The output in this case is: [4, 5, 434, 9]
But I want to print it without the brackets - only the numbers: 4, 5, 434, 9