The rehash() method is used to increase the capacity and internally reorganizes this hashtable.This is done to accommodate and access its entries more efficiently.This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity.
Following is the declaration for java.util.Hashtable.rehash() method.
protected void rehash()
This is a protected method and called automatically when the number of keys in the hashtable exceeds this hashtable's capacity.So the stand alone application can not be used to test the method.
Let us compile and run the above program, this will produce the following result.