java中Map类的子类HashMap的对象hashmap的put方法没有方法体

java中Map类的子类HashMap的对象hashmap的put方法为什么没有方法体,
HashMap hashmap = new HashMap( );
hashmap.put( "Item0" ," Value0");
......
应该如何理解呢,谢谢分析解答

我们只是使用put方法,不去关注怎么实现的。
如果你想知道方法体,请去查看jdk源码

怎么会没有方法体呢,,,,应该是你找错地方了吧,估计你找到的是Map的put()了,
HashMap是继承Map的,肯定是会实现put()方法,恩,下面是找到的方法体
/**
* Associates the specified value with the specified key in this map.
* If the map previously contained a mapping for the key, the old
* value is replaced.
*
* @param key key with which the specified value is to be associated
* @param value value to be associated with the specified key
* @return the previous value associated with key, or
* null if there was no mapping for key.
* (A null return can also indicate that the map
* previously associated null with key.)
*/
public V put(K key, V value) {
if (key == null)
return putForNullKey(value);
int hash = hash(key.hashCode());
int i = indexFor(hash, table.length);
for (Entry e = table[i]; e != null; e = e.next) {
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k))) {
V oldValue = e.value;
e.value = value;
e.recordAccess(this);
return oldValue;
}
}

    modCount++;
    addEntry(hash, key, value, i);
    return null;
}

怎么可能没有方法体,作为一个具体的类,没有方法体就没有办法将键值对放到hash表里

代码都封装了,都写死了。不像list的add

hashMap类中 put()方法 实现在源码中。你这里只是调用当然不用写方法体。 HashMap实现了 Map接口 , 方法体在源码中