what is the difference between HashMap and Hashtable

Answer Posted / knowledge_finder

1. HashMap allows null values for key and value whereas
Hashtable doesnt allow.
2. HashMap does not guarantee that the order of the map will
remain constant over time. 3. HashMap is non synchronized
where as Hashtable is synchronized.
4. HashTable is an Old java class but Hashmap is a new java
class in java 2.
5. In HashTable you can change the iteration but in the case
of HashMap you can change the iteration but you will get a
java.util.ConcurrentModificationException.

Is This Answer Correct ?    35 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a default constraint?

808


Why do we use string?

770


What is difference between jdk,jre and jvm?

772


Can we use both this () and super () in a constructor?

763


Why hashmap is used in java?

745


Why declare Main() method as a static in java ?

796


How do we access static members in java?

825


When is the finalize() called?

901


What is difference between null and void?

718


How to sort elements in a parallel array in java?

672


Explain the init method?

720


'A class is a template for an object' explain this statement.

733


What is main in java?

768


Can we sort a map in java?

749


What is the use of set in java?

835