import java.util.ArrayList;
import java.util.Random;
//键盘打印26个大小写字母,并随机生成3位验证码
public class yzm {
public static void main(String[] args) {
char da = 'A';
char xiao ='a';
ArrayList<Character> a = new ArrayList<Character>();
for (int i =0;i<26;i++){
/* System.out.print(da+" ");
System.out.println(xiao);
da++;
xiao++;
}*/
char c = (char)(da+i);
char c1 = (char)(xiao+i);
a.add(c);
a.add(c1);
System.out.print(c+" ");
System.out.println(c1);
}
System.out.print("验证码为:");
Random r = new Random();
for (int i=0;i<3;i++){
int n = r.nextInt(52);
System.out.print(a.get(n));
}
}
}
|
|