日期:2014-05-20 浏览次数:20631 次
String [] s = {"sdf", "efd", "wefd", "efdd"}; final String[] target = new String[3]; final Random random = new Random(); for(int i = 0 ; i < 3; i ++) { int index = random.nextInt(s.length); target[i] = s[index]; } System.out.println(Arrays.toString(target));
------解决方案--------------------
用split数组分割法,保存到数组中,然后random,在取值