import java.util.Random;
public class code {
public static void main(String[] args) {
Random random = new Random();
System.out.print("5位小写字母组成的验证码为:");
for (int i = 0; i < 5; i++) {
int a = random.nextInt(122 - 97 + 1) + 97;
System.out.print((char) (a));
}
}
}
效果图: