publicclassMain{publicstaticvoidmain(String[] args){
String s ="abcd";char[] value = s.toCharArray();for(char c : value){
System.out.print(c +" ");//a b c d}}}
char[]转String
publicclassMain{publicstaticvoidmain(String[] args){char[] value =newchar[]{'a','b','c','d'};
String s =newString(value);//通过String类的构造方法
String s2 = String.valueOf(value);//String类的valueOf()方法}}
char[]转ArrayList<Character>
import java.util.ArrayList;import java.util.List;publicclassMain{publicstaticvoidmain(String[] args){char[] value =newchar[]{'a','b','c','d'};
List<Character> list =newArrayList<>();for(char c : value){
list.add(c);}
System.out.println(list.toString());}}