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


Please Help Members By Posting Answers For Below Questions

Can we declare an array without size in java?

524


Can we overload run() method in java?

599


Can we overload the constructors?

563


Can we override the overloaded method?

568


How does thread synchronization occurs inside a monitor?

558






Can java run on google chrome?

578


what do you understand by the term string with respect to java?

533


Which variables are stored in heap?

543


How many characters is 16 bytes?

545


Is null a string in java?

558


What is the difference between abstract classes and interfaces?

518


What are the data types supported by java?

550


Differentiate between static and non-static methods in java.

571


What is the difference between heap and stack memory?

549


What is toarray method in java?

562