import java.util.Random;
public class Main {
public static void charCode() {
StringBuilder sb = new StringBuilder(); Random random = new Random(); for (inti= 0; i < 5; i++){
int randomCharType = random.nextlnt(2);/ 随机选择大小写
if (randomCharType == 0){/大写字母
char c = (char) (random.nextlnt(26) +
'A');
sb.append(c);} else {
/小写字母
char c = (char)(random.nextlnt(26) +
'a');
sb.append(c);}}
System.out.println(sb.toString() + "#★");}
public static void main(String[] args){ charCode(); // 调用方法
C知道
}