怎么会?是不是你的循环写错了?
while(itor.hasNext()){
Object obj = hashmap.get(itor.next());
}
while(itor.hasNext()){
Object obj = hashmap.get(itor.next());
}
解决方案 »
- swt
- 为什么SQL Server float数据与Java Float数据不一致
- Double型数据相加
- [求助]java数据结构
- swing中的painting
- com.sun.java.util.collections.*哪里找?
- Panel重绘背景后,其内部组件可以也重绘么?
- 请教中间件(我是初学者)
- 怎样才知道我准备好考scjp呢?考一次可是很贵呀,我不想失败!
- 请教Java高手一个include问题。
- Applet中添加PopMenu或是Dialog时为什么在底部总有“Java Applet Window”?如何去掉:
- 在某个目录下有一些相同文件名不同扩展名的文件1.doc,1.txt,1.html,如何删除文件名为1的这些不同扩展名的文件
public HashmapIterator() {
}
public static void main(String[] args){
HashMap hm = new HashMap();
hm.put(new String("name"),new String("author"));
hm.put(new String("sex"),new String("male"));
hm.put(new String("city"),new String("beijing"));
Iterator it = hm.keySet().iterator();
while(it.hasNext()){
String key = (String)it.next();
String value = (String)hm.get(key);
System.out.println(key + " = " + value);
}
}
}