请看下面代码:
import java.util.*;
class MapDemo
{
public static void sop(Object obj)
{
System.out.println(obj);
}
public static void main(String[] args)
{
Map<String,String> map=new HashMap<String,String>();
sop("put:"+map.put("01","linlin01"));//添加键值为"01","linlin01",打印结果为null,为什么?
sop("put:"+map.put("01","tangwei"));
sop(map);
}
}
|
|