欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

java 随机字母类,java字母类,import java.

来源: javaer 分享于  点击 38528 次 点评:180

java 随机字母类,java字母类,import java.


import java.util.Random;public class ExtRandom extends Random {private String output = "";public String nextLetter() {switch (nextInt(26)) {case 0: output = "a"; break;case 1: output = "b"; break;case 2: output = "c"; break;case 3: output = "d"; break;case 4: output = "e"; break;case 5: output = "f"; break;case 6: output = "g"; break;case 7: output = "h"; break;case 8: output = "i"; break;case 9: output = "j"; break;case 10: output = "k"; break;case 11: output = "l"; break;case 12: output = "m"; break;case 13: output = "n"; break;case 14: output = "o"; break;case 15: output = "p"; break;case 16: output = "q"; break;case 17: output = "r"; break;case 18: output = "s"; break;case 19: output = "t"; break;case 20: output = "u"; break;case 21: output = "v"; break;case 22: output = "w"; break;case 23: output = "x"; break;case 24: output = "y"; break;case 25: output = "z"; break;}return output;}}
相关栏目:

用户点评