生成验证码

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

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