import java.util.*;
public class HashMapDemo
{
public static void main(String [] args)
{
//创建一个HashMap对象hm
HashMap hm=new HashMap();
//加入元素到hm中
hm.put("何叶",new Double (213213421.333));
hm.put("张光明",new Double (67231.233));
hm.put("张三",new Double (812371.23));
hm.put("李四",new Double (231231.231));
//返回包含映射中项的集合
Set set=hm.entrySet();
//用Iterator得到HashMap中的内容
Iterator t=set.iterator();
//显示元素
while(t.hasNext())
{
Map.Entry me=(Map.Entry)t.next();
System.out.print(me.getKey()+": ");
System.out.println(me.getValue());
}
System.out.print("\n");
double balance=((Double)hm.get("张光明")).doubleValue();
hm.put("张光明",new Double(balance+89728));
System.out.println("我现在的账户金额:"+hm.get("张光明"));
}
}
上面 的代码为什么编译错误?

编译报错信息可否给一下,不想把代码复制过去调了,,,
没有编译错误
输出:
李四: 231231.231
张三: 812371.23
何叶: 2.13213421333E8
张光明: 67231.233
我现在的账户金额:156959.233
我在cmd里编译的,说有错误,使用了未经检查或不安全的代码,详细信息使用X-unchecked重新编译
现在都是泛型,所以需要添加类型
HashMap<String,Double> hm=new HashMap<String,Double>();
Set<Map.Entry> set=hm.entrySet();
你那个是警告,可以忽略,一开始学,建议先用IDE,等熟练了在使用cmd.