随机四位验证码


        import java.util.Random;

        public class Homework0511 {

        public static void main(String[] args) {


Random rand=new Random(); String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; System.out.print("验证码是(区分大小写):"); for(int i=0;i<4;i++) { int p=rand.nextInt(61); System.out.print(str.substring(p, p+1)+" "); } }
}


 

运行结果:

原文地址:https://www.cnblogs.com/miss123/p/5484323.html