List<String> list = new ArrayList<String>();
//list中添对象
list.add("a");
list.add("b");
list.add("c");
StringBuffer sb = new StringBuffer();//不定长数组
for(String s:list){
sb.append(s)
}
System.out.println(sb.toString());
输出 abc
public static void main(String[] args){
String str = "爱上九点半";
char[] abc = str.toCharArray();
for(int i=0;i<abc.length;i++)
System.out.println(abc[i]);
}
时间: 2024-10-01 05:19:04