你什么意思?数组索引是普通数,因此您可以轻松地执行
String names[] = { "One", "Two", "Three", "Four", "Five", "Six" };Random Dice = new Random(); int n = Dice.nextInt(6); System.out.println(names[n]);还是说随机的Iterator类?Google是您的朋友,这是我的第一个热门。

你什么意思?数组索引是普通数,因此您可以轻松地执行
String names[] = { "One", "Two", "Three", "Four", "Five", "Six" };Random Dice = new Random(); int n = Dice.nextInt(6); System.out.println(names[n]);还是说随机的Iterator类?Google是您的朋友,这是我的第一个热门。