日期:2014-05-20 浏览次数:20802 次
String[] cc = {"a","b","c"}; List<String> cca = null; cca = new ArrayList<String>(); cca.add("z"); for(int i = 0; i<3; i++){ cca.add(cc[i]); } System.out.println(cca) ;
------解决方案--------------------
String[] cc = {"a","b","c"};
List<String> cca = new ArrayList<String>();
for(int i = 0; i<3; i++){
cca.add("z");
cca.add(cc[i]);
------解决方案--------------------
String[] cc = {"a","b","c"}; List<String> cca = new ArrayList<String>(); cca.add("z"); for(int i = 0; i<3; i++){ cca.add(cc[i]); }
------解决方案--------------------
import java.util.ArrayList; import java.util.List; public class b { public static void main(String[] args) { String[] cc = {"a","b","c"}; List<String> cca = new ArrayList<String>(); cca.add("z"); for (int i = 0; i < cc.length; i++) { cca.add(cc[i]); } System.out.println(cca); } }