码迷,mamicode.com
首页 > 其他好文 > 详细

生成验证码

时间:2016-03-11 23:54:07      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
package Zuoye1;

import java.util.*;



public class Choujiang {
    
    public static void main(String[]args)
    {
        
        String str = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
        Random yan=new Random();
        for(int i=0; i<4; i++)
             {
             int j = yan.nextInt(str.length()-1);
             
             String s = (str.substring(j, j+1));
             
             System.out.print(s);
             }
    }
}
View Code

技术分享

生成验证码

标签:

原文地址:http://www.cnblogs.com/1ming/p/5267426.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!