import java.util.*;
public class SetTest {
public static void main
(String args[]) {
String names[] = {"홍명보", "안정환", "차두리","히딩크", "황선홍",
"이운재", "설기현", "황선홍"};
Set koreaTeam = new HashSet();
int namesLen
= names.length;
int index;
for (int i=0; i < 100; i++) {
index = (int)(Math.random()*namesLen);
koreaTeam.add (names[index]);
}
Iterator it = koreaTeam.iterator();
while (it.hasNext())
{
System.out.println (it.next());
}
} }
댓글 없음:
댓글 쓰기