标签:array scan stat ++ length bsp main 相互 字符
1.字符串转化为字符数组
public class Hello { public static void main(String args[]){ Scanner input = new Scanner(System.in); String str="abc"; char[] c=str.toCharArray(); for(int i=0;i<c.length;i++) System.out.print(c[i]); } }
2.字符数组转化为字符串
public class Hello { public static void main(String args[]){ char[] cc={‘a‘,‘b‘,‘c‘}; String s=String.valueOf(cc); System.out.println(s); } }
标签:array scan stat ++ length bsp main 相互 字符
原文地址:https://www.cnblogs.com/nomouren/p/9826691.html