1 String str11 = "abcdefghijklmnopqrstuvwxyz"; 2 String str12 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 3 String str13 = "12345678901234567890123456"; 4 System.out.println("请输入验证码:"); 5 for(int x = 1; x <= 4; x++) 6 { 7 Random a = new Random(); 8 Random b = new Random(); 9 Random c = new Random(); 10 Random d = new Random(); 11 int m = a.nextInt(26); 12 int f = c.nextInt(26); 13 int e = d.nextInt(26); 14 int n = b.nextInt(3); 15 if(n == 0) 16 { 17 System.out.print(str11.charAt(e) + " "); 18 } 19 else if(n == 1) 20 { 21 System.out.print(str12.charAt(f) + " "); 22 } 23 else if(n == 2) 24 { 25 System.out.print(str13.charAt(m) + " "); 26 } 27 }