123456789101112131415161718192021222324252627 |
- package samples.technology.reference;
- import java.util.*;
- public class HashtableAdd{
-
- public static void main(String[] args){
-
- Hashtable ht = new Hashtable();
- StringBuffer sb = new StringBuffer();
- sb.append("abc,");
- ht.put("1",sb);
- sb.append("def,");
- ht.put("2",sb);
- sb.append("mno,");
- ht.put("3",sb);
- sb.append("xyz.");
- ht.put("4",sb);
-
- int numObj=0;
- Enumeration it = ht.elements();
- while(it.hasMoreElements()){
- System.out.print("get StringBufffer "+(++numObj)+" from Hashtable: ");
- System.out.println(it.nextElement());
- }
- }
- }
|