如果是 “字符串數組” 轉 “字符串”,只能通過循環,沒有其它方法
String[] str = {"abc", "bcd", "def"};
StringBuffer sb = new StringBuffer();
for(int i = 0; i < str.length; i++){
sb. append(str[i]);
}
String s = sb.toString();
如果是 “字符數組” 轉 “字符串” 可以通過下邊的方法
char[] data={'a','b','c'};
String s=new String(data);
轉自:
