随机验证码

package learn;

import java.util.Random;

public class yanzhengma {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

    Random rm = new Random();    
        
    String Str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    
    System.out.print("验证码:");
    
    for(int i = 1; i < 5 ; i++)
    {
        int c = rm.nextInt(62);
        
        System.out.print(Str.subSequence(c, c+1));   
    }
    
原文地址:https://www.cnblogs.com/OldZhao/p/4873465.html