import java.util.Dictionary; |
import java.util.Hashtable; |
public class Test { |
public static void main(String[] args) { |
Dictionary<String, String> hashTable = new Hashtable<String, String>(); // Dictionary是抽象类,由其子类Hashtable实现 |
hashTable.put( "s1" , "baidu" ); |
hashTable.put( "s2" , "google" ); |
String str = hashTable.get( "s1" ); |
System.out.println( "s1=" + str); |
str = hashTable.get( "s2" ); |
System.out.println( "s2=" + str); |
} |
} |