Map keySet()
{
/* Key Adobe; Value Mountain View, CA Key IBM; Value White Plains, NY Key Learning Tree; Value Los Angeles, CA */ import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class MainClass { public static void main(String[] argv) { Map map = new HashMap(); map.put("Adobe", "Mountain View, CA"); map.put("IBM", "White Plains, NY"); map.put("Learning Tree", "Los Angeles, CA"); Iterator k = map.keySet().iterator(); while (k.hasNext()) { String key = (String) k.next(); System.out.println("Key " + key + "; Value " + (String) map.get(key)); } } }
}
'Languages > Java' 카테고리의 다른 글
JAVA - JDBC, Supported Database, JDBC Drivers, and Deployment Containers (0) | 2012.08.15 |
---|---|
JAVA - PreparedStatement 로 한글 2000자 입력하기. (0) | 2012.08.15 |
JAVA - 설정된 java class path 정보 확인하기. (0) | 2012.08.15 |
JAVA - System.getProperty(String key, String def) (0) | 2012.08.15 |
JAVA - java.net.UnknownHostException (0) | 2012.08.15 |