代码如下:
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Map<String, String> map = new HashMap<String, String>();
map.put("name", "user");
map.put("password", "12345");
Set<Map.Entry<String, String>> set = map.entrySet();
for (Map.Entry<String, String> en : set) {
System.out.println(en.getKey() + ":" + en.getValue());
}
}
}