java中给字符数组批量赋值,可以使用for-each来给字符数组赋值,代码如下:
package com.qiu.lin.he;
public class CeShi {
public static void main(String[] args) {
char c[] = new char[26];
String s = "abcdefghijklmnopqrstuvwxyz";
char ss[] = s.toCharArray();
for (int i = 0; i < ss.length; i++) {
c[i] = ss[i];//给字符数组赋值
}
for (char x : c) {
System.out.print(x);//循环输出字符数组的内容
}
}
}
结果如下:
main函数如下:
char c[]=new char[26];
String s="abcdefghijklmnopqrstuvwxyz";
char ss[]=s.toCharArray();
for(int i=0;i
}
for(char x:c) System.out.print(x);
for(int i = 0,j = 1; i
}
写一个
int function (char input){
return ((input-a)+1);
}
char[] ss ="1234567890abcdef....xyz".toCharArray();