package com.hanqi; import java.util.Random; public class zuoyesjscyzm { public static void main(String[] args) { System.out.println("请输入验证码:"); String a="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random r = new Random(); { for( double i =0; i<4; i++) { int s=r.nextInt(62); System.out.print(a.substring(s,s+1)); } } } }