what is the difference between HashMap and Hashtable
Answer Posted / chandan
The key difference between the two is that access to the
Hashtable is synchronized on the table while access to the
HashMap isn't. You can add it, but it isn't there by default.
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.
And, a third difference is that HashMap permits null values
in it, while Hashtable doesn't.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Differences between C and Java?
Can list be final in java?
What are the pillars of java?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
When is an object subject to garbage collection?
What is reverse function?
What is the use of predicate in java 8?
Explain try and catch keywords in java?
What are the drawbacks of reflection?
What is immutable state?
What is meant by overloading?
Why is the type for real numbers called double?
Why can't we make a class private in java?
What is namespace in java?
Can we change the scope of the overridden method in the subclass?