Spot why this StringBuilder loop returns only the last item instead of all of them.
Codejava
public String joinNames(List<String> names) {
String result = "";
for (String name : names) {
StringBuilder sb = new StringBuilder();
sb.append(name).append(", ");
result = sb.toString();
}
return result;
}