class A{
private static Map<String,String> map=new HashMap<String,String>();
public A()
{
map.put("micky","hello");
map.put("micky","hey");
}
public int size()
{
return map.size();
}
public static void main(String[] args)
{
System.out.println(map.size());
}
//爲什麼它給出0作爲答案。有人能解釋我嗎? }收集框架中的HashMap
你認爲,爲什麼它不應該是0? – Seelenvirtuose