JAVA 让存放在String类型的数组中的汉字随机出现在文本框里。

JAVA 让存放在String类型的数组中的汉字随机出现在文本框里。

public class Test{

public static void main(String[] args){

String str = "sdswe我是是倒萨";

int num = 0;
String array = "";
for(int i = 0;i<str.length();i++){
char ch = str.charAt(i);
if((ch+"").getBytes().length == 2){
array += ch;
}
}

System.out.println(array);

char[] a = array.toCharArray();

System.out.println(a);
}

}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答