I'm trying to write a method that will use a for loop to iterate through all the positions in an ArrayList and add them to a String. I then want to return that String outside the for loop. Whenever I do this my for loop is ignored and what I initialised the String with is what is returned instead :S
String wordPos = null;
for (int i = 0; i < position.size() - 1; i++)
wordPos = wordPos + position.get(i);
I hope you can tell me what is going wrong or a better way of doing this.
wordPos = "";
And are you sure that you made your ArrayList a "String type".
I hope this helps you?