When you create your own key object for use in a Hashtable, you must override the Object.equals() and Object.hashCode() methods since Hashtable uses a combination of the key's hashCode() and equals() methods to store and retrieve its entries quickly. It's also a general rule that when you override equals(), you always override hashCode().

重寫equals():
???? 1.沒有重寫equals()意味著什么?
???? 2. 設(shè)計equals()方法
???? 3.equals()約定

?重寫hashCode():
???? 1.理解散列碼
???? 2.設(shè)計hashCode()
???? 3.hashCode()約定重寫equals():