import java.util.HashSet;
import java.util.Iterator;
public class HashSetTest
{
public static void main(String args[])
{
HashSet<Integer> h = new HashSet<>();
while(h.size()<6)
{
int i = (int)(Math.random()*45+1);
h.add(i);
}
Iterator<Integer> it = h.iterator();
while(it.hasNext())
System.out.print(it.next()+" ");
}
}
댓글 없음:
댓글 쓰기