调用CharArray()方法 例如 String a = "qweradsf";char[] c =a.CharArray();这个方法就是将字符串中的字符一个一个添加进去 String
java 怎么样把读入的字符串放到数组中
String str="abcdefg";
char[] a=str.CharArray();
以下是说明:
public char[] toCharArray()
Converts this string to a new character array.
Returns:
a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.2011-01-13
调用CharArray()方法 例如
String a = "qweradsf";
char[] c =a.CharArray();
这个方法就是将字符串中的字符一个一个添加进去2011-01-14
如果不知道转换函数的话,可以一个一个赋值2011-01-13