1、将char数组转换为String类型
运用String类的valueOf()函数。
char[] cha = {'s','g','h'};
String n = String.valueOf(cha);
2、将String类型转换为一个char类型的数组
1)用toCharArray()方法
String n = "hello word";
n.toCharArray();
2)用charAt()方法
String n = "hello word";
char[] str = new char[n.length()];
for(int i=0;i<n.length();i++)
{
str[i] = n.charAt(i);
}
System.out.println(str);