what is the difference between HashMap and Hashtable
Answer Posted / tarun kumar
class Hashtable was part of the original java.util and is a
concreate implementation of a Dictionary class. In java2 it
is reengineering it so that it also implements the Map
interface.
Thus it is now integrated into the collections framework.
class HashMap implements Map interface.
Because, Hashtable is a concreate implementation of
Dictionary class, is Legacy class, all legacy classes are
synchronized. So,thats why Hashtable is sunchronized.
I can say that both Hashtable and HashMap are same, accept
synchronization.
| Is This Answer Correct ? | 22 Yes | 25 No |
Post New Answer View All Answers
What is illegal identifier in java?
What are the different data types in java?
What is difference between calling start() and run() method of thread?
Give me example of derived data types.
Why java is said to be pass-by-value ?
What is the effect of keeping a constructor private?
What is string builder?
Why collection doesn’t extend cloneable and serializable interfaces?
Difference between start() and run() method of thread class?
Why webdriver is an interface?
Explain wrapper classes in java?
What are the types of literals?
Can we create object of static class?
What is the point of java?
What are the 3 types of loops in java?