title: Conversion ways from hashmap to hashtable
body: <p>I am using the following program for converting from hashmap to hashtable
  I used two different methods for converting, one is giving ht1 and other is giving ht2</p>
  
  <p>What is the difference between ht1 and ht2?</p>
  
  <pre><code>import java.util.HashMap;
  import java.util.Hashtable;
  import java.util.Map;
  
  public class HashMapToHashTable {
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          Map &lt;Integer,Integer&gt;hm = new HashMap&lt;Integer,Integer&gt;();
          hm.put(1, 2);
          hm.put(3, 4);
          System.out.println(hm.keySet());
          //First way of converting hashmap to hashtable
          Map &lt;Integer, Integer&gt;ht1 = new Hashtable&lt;Integer,Integer&gt;(hm);
          System.out.println(ht1.keySet());
          //Second way of converting hashmap to hashtable
          Map &lt;Integer, Integer&gt;ht2 = new Hashtable&lt;Integer,Integer&gt;();
          ht2.putAll(hm);   
          System.out.println(ht2.keySet());       
      }
  }
  </code></pre>
  
  <p>Will this Collections.synchronizedMap(hm) also be used to convert from hashmap to hashtable?</p>
  
  <p>Thanks in advance.</p>