public class HuoQu_Random {
public static void main(String[] args) {
ArrayList nb=new ArrayList();
while(nb.size()<10){
int x=new Random().nextInt(21);
if(nb.contains(x)){
}else nb.add(x);
}
System.out.println(nb);
Iterator nb1=nb.iterator();
while(nb1.hasNext()){
Object nb2=nb1.next();
System.out.print(nb2+" ");
}
}
}
|
|