I have a code to concatenate strings. However, for some reason, the final string is not a combination of the required strings. Consider the following code :
//cusEmail is of type String[]
String toList = "";
for(i=0; i < cusEmail.length - 1; i++) {
toList.concat(cusEmail[i]);
toList.concat("; ");
System.out.println(cusEmail[i]);
}
toList.concat(cusEmail[i]);
System.out.println(toList);
The first sout statement displays the strings in cusEmail[i] correctly. However, once concatenated, the second sout displays a blank / empty. Any reason for this? Am i concatenating it correctly?