生成验证码

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

posted @ 2016-03-11 22:11  百事没事  阅读(125)  评论(0编辑  收藏  举报