怎么样把一个数组中的所有元素取出来组成一个字符串

如题所述

//用java写的假如这个数组里的元素都是字符类型的
public class ArrayString {
public static void main(String[] args) {
char[] a = new char[15];
char s= 'a';
for(int i = 0;i <= 10;++i)
a[i] = s++;
String str = "";
for(int i = 0;i <= 10;++i)
    str +=a[i];//把所有字符加起来强转成字符串
System.out.println(str);//打印字符串

}

}

温馨提示:答案为网友推荐,仅供参考
相似回答