随机四位验证码


        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)+" "); } }
}

 

 

运行结果:

posted @ 2016-05-12 08:41  鱼在我这里  阅读(158)  评论(0编辑  收藏  举报