I have an ArrayList
and I want to output completely as a String with separated by comma
.
My code is
ArrayList<String> list = new ArrayList<String>();
list.add("one");
list.add("two");
list.add("three");
String listString = "";
for (String s : list)
{
listString += s + ",";
}
System.out.println(listString);
But the output is one,two,three,
and i want one,two,three
without using replace method
.
I am using JAVA