what is the difference between HashMap and Hashtable
Answer Posted / jyotsna gupta
1. Hashtable is synchronized where as hashmap is not.
2. Hashmap can contains null values as the keys and as well as values.But Hashtable dose not allow null values as keys and values.
3. Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't. If you change the map while iterating, you'll know.
4. Hashmap is faster than Hashtable.
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What are the differences between heap and stack memory in java?
What are thread local variables?
What is data type in computer?
What is a lightweight component?
What will be the initial value of an object reference which is defined as an instance variable?
What is the role of garbage collector in java?
Explain covariant method overriding in java.
What does java final mean?
What is bubble sorting in java?
What is the purpose of the System class?
What is the symbol for average?
What is qms certification?
Explain the scope or life time of class variables or static variables?
How do you compare two objects?
Can you override private or static method in java?