public static final String getString(final String[] array){ Random r = new Random(); int index = Math.abs(r.nextInt()) % array.length; return array[index]; }
或者返回类型为一个字符串数组: public static final String[] getStringArray(final String[] array){ Random r = new Random(); int index = Math.abs(r.nextInt()) % array.length; String[] s = {array[index]}; return s; }