Hashtable overriding
<p>This is my first time using this website so I apologize if I am not using it correctly. Please do let me know.</p>

<p>Anyway I have an Account object that takes in 2 strings... An acctName, and lastName (Code is below). </p>

<p>I want to insert this object into a hash table with the key being the acctName and I would  like to use polynomials for reducing collision. I have heard that I must override hashCode() and equal method. I believe I have overridden correctly  but I am not sure it is correct because it seems to not be called. Can someone tell me if I am doing this right (Overriding in the right location and adding correctly) and explain to me how to print after an add?</p>

<p>Thanks and looking forward to contributing to the community in the future!</p>

<p><strong>Class---> Account</strong></p>

<pre><code>public class Account
{

 private String acctName;
 private String lastName;

 public Account(String acctName, String lastName)
  {
   this.acctName= acctName;
   this.lastName= lastName
   }

 @Override
public int hashCode() {

    return acctName.hashCode() + lastName.hashCode();

}

@Override
public boolean equals (Object otherObject) {
    if (!(otherObject instanceof Account)) {
        return false;
    }
    if (otherObject == this) {
        return true;
    }

    Account accountHolder = (Account) otherObject;
    return acctName.equals(accountHolder.acctName) &amp;&amp; lastName.equals(accountHolder.lastName);
}
</code></pre>

<p><strong>Class----> Driver</strong></p>

<pre><code> public void insertInto()
{
 Hashtable&lt;String,Account&gt; hash=new Hashtable&lt;String,HoldInformation&gt;();
 Account account= new Account ("Deposit", "Jones");
 Account account2= new Account ("Withdraw", "Smith");


 hash.put ("deposit", account);
 hash.put ("Withdraw", account2);

 }
</code></pre>

<p><strong>EDIT WITH GETTER INSIDE Account Object</strong></p>

<pre><code>   public String testGetter()
  {

     return acctName.hashCode() + lastName.hashCode();
    }
</code></pre>
