HashSet
import java.util.*;
class HashSetTest
{
public static void main(String[] args)
{
HashSet<String> hs = new HashSet<String>();
Scanner sc = new Scanner(System.in);
String s = new String();
System.out.println("input strings(to quit,please input quit):");
System.out.print('#');
while( !(s = sc.next()).equals("quit") )
hs.add(s);
for(String str : hs)
System.out.println(str);
}
}
class HashSetTest
{
public static void main(String[] args)
{
HashSet<String> hs = new HashSet<String>();
Scanner sc = new Scanner(System.in);
String s = new String();
System.out.println("input strings(to quit,please input quit):");
System.out.print('#');
while( !(s = sc.next()).equals("quit") )
hs.add(s);
for(String str : hs)
System.out.println(str);
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.