695212308 发表于 2016-8-21 10:37
public class Test {
public static void main(String[] args) {
int[] arr=new int[10];
public static void main(String[] args) {
HashSet<Integer> hs = new HashSet<Integer>();
Random random = new Random();
while (hs.size() < 5) {
//获取一个1-10之间的随机数
int temp = random.nextInt(9) + 1;
hs.add(temp);
}
for (Integer integer : hs) {
System.out.print(integer + " ");
}
}
小小丶白 发表于 2016-8-21 16:04
[mw_shl_code=applescript,true] public static void main(String[] args) {
HashSet hs = new HashSet() ...
小小丶白 发表于 2016-8-21 16:04
[mw_shl_code=applescript,true] public static void main(String[] args) {
HashSet hs = new HashSet() ...
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |