JAVA/sample JAVA
[sample] HashMap 사용방법
달려라네오
2007. 1. 23. 14:50
public static void main(String argv[]) {
HashMap hm = new HashMap();
System.out.println(hm.put("aaa", "111"));
Set set = hm.keySet();
Object []hmKeys = set.toArray();
for(int i = 0; i < hmKeys.length; i++) {
String key = (String)hmKeys[i];
System.out.print(key);
System.out.print(" - ");
System.out.println((String)hm.get(key));
}
}
HashMap hm = new HashMap();
System.out.println(hm.put("aaa", "111"));
Set set = hm.keySet();
Object []hmKeys = set.toArray();
for(int i = 0; i < hmKeys.length; i++) {
String key = (String)hmKeys[i];
System.out.print(key);
System.out.print(" - ");
System.out.println((String)hm.get(key));
}
}