Topic: jdk1.5 hashmap put unchecked compile warnning?

  Print this page

1.jdk1.5 hashmap put unchecked compile warnning? Copy to clipboard
Posted by: andersonmao
Posted on: 2005-05-27 15:23

I am using jdk1.5 to compile a java source file.[jdk-1_5_0_03-windows-i586-p.exe]
when do this:

Map map=new HashMap();
map.put("abc","def");

the compiler output warning like:

[javac] xxx.java 使用了未经检查或不安全的操作。
[javac] 注意: 要了解详细信息,请使用 -Xlint:unchecked 重新编译。

I think this something about the generic.
When change to this:

Map<Object,Object> map=new HashMap<Object,Object>();
map.put("abc","def");

compiler OK.
Can anybody tell me it is a compiler error or other reason?
Thanks.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923