交个作业emmm
List<String> list = new ArrayList<>(); String strings = "qwertyuiopasdfghjklzxcvbnmMNBVCXZASDFGHJKLPOIUYTREWQ"; String s = ""; for (int i=0; i<10;i++) { do { s += strings.charAt((int)(Math.random() * strings.length() -1)); }while (list.contains(s) || s.length() < 10); list.add(s); s = ""; } for (String ss: list) { System.out.println(ss); } System.out.println("我是分隔符——————————————————————————————————————————————"); Collections.sort(list); for (String sss: list) { System.out.println(sss); }