Does “put” overwrite existing values?

前端 未结 2 1602
清歌不尽
清歌不尽 2021-02-06 20:09

New to hashtables with a simple question. For some reason googling hasn\'t gotten me a straight answer. Say I\'ve got an hashtable set up:

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-06 20:42

    hmmm ,just need add a line
    myHashtable.put(1,"fish");
    to see what's amazing happens

    see this links:http://docs.oracle.com/javase/6/docs/api/java/util/Hashtable.html#put(K, V)

    Returns:
    the previous value of the specified key in this hashtable, or null if it did not have one
    

提交回复
热议问题