随机验证码

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

 

posted @ 2015-10-13 08:54  老趙  阅读(136)  评论(0编辑  收藏  举报