总结:代码代码你认得我吗?
package com.c2; import java.util.ArrayList; //list import java.util.List; public class hgf { public static String listToString(List<String> stringList) { if (stringList == null) { return null; } StringBuilder result = new StringBuilder(); boolean flag = true;// 这是个循环变量吗? for (String string : stringList) {// 这个“” if (flag) { result.append(","); } else { flag = true; } result.append(string); } return result.toString(); } public static void main(String[] args) { List<String> list = new ArrayList<String>(); list.add("dfds"); list.add("ccc"); list.add("eee"); System.out.println(listToString(list)); } }