hashMap 变量

刚才网上看到

Map map = new HashMap();
map.put("a", "李荣");
map.put("b", "张明");
map.put("c", "小张");
//方法1:用entrySet()
Iterator it=map.entrySet().iterator();
while(it.hasNext())
{
Map.Entry m=(Map.Entry)it.next();
System.out.println("键:"+m.getKey()+" 值:"+m.getValue());
}

//方法2:直接在循环中
for(Map.Entry m:map.entrySet())
{
System.out.println("键:"+m.getKey()+" 值:"+m.getValue());
}

你可能感兴趣的:(oracle,C,C++,C#)