what is the difference between HashMap And HashTable?

Answers were Sorted based on User's Feedback



what is the difference between HashMap And HashTable?..

Answer / ravikiran

HashMap allows one null key and multiple null values
HashTable doesnn't allow nulls
HashMap is not synchronized
hashtable is synchronized

Is This Answer Correct ?    13 Yes 0 No

what is the difference between HashMap And HashTable?..

Answer / stalin

The HashMap class is roughly equivalent to Hashtable, except
that it is unsynchronized and permits nulls. (HashMap allows
null values as key and value whereas Hashtable doesnt
allow). HashMap does not guarantee that the order of the map
will remain constant over time. HashMap is unsynchronized
and Hashtable is synchronized

Is This Answer Correct ?    8 Yes 0 No

what is the difference between HashMap And HashTable?..

Answer / guest

HashMap is a nonsyncronized and HashTable is a
syncronized.

Is This Answer Correct ?    7 Yes 0 No

what is the difference between HashMap And HashTable?..

Answer / venkateswarlu

HashMap :
->It is a key,value pair.
->key are not duplicated but values can be duplicated.
->Null key is possible.
->It is not Synchronized by default.

Hashtable:
->It is also key,value pair but both are Strings only.
-> Keys are not duplicated but values can be duplicated.
->Null insertion is not possible of both(key and value).
->It is Synchronized by default.

Is This Answer Correct ?    0 Yes 0 No

what is the difference between HashMap And HashTable?..

Answer / raghu

HashMap only one null key and multiple values. Hashtable
doesn't allow null keys and values, it throws
NullPointerException. Both are not guarantee order. HashMap
is unsyncronized, whereas Hashtable is not.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

What do you know about the garbage collector?

0 Answers  


Can you give few examples of final classes defined in java api?

0 Answers  


What is volatile keyword in java

0 Answers  


Is it possible to write static method in abstract class? justyfy your answer?

5 Answers   Hexaware,


Explain the difference between an object-oriented programming language and object-based programming language?

0 Answers  






What are parent methods and how can you call them?

2 Answers  


Accenture NJ mostly ask question on Collection like 1)How to sort Objcts and how treeset sort them 2)Explain mechanism of Hashcode finding in Java 3)Name some of the Sorted collection.

2 Answers   Accenture,


What is audio clip interface? Name few methods of it ?

1 Answers  


What is the base class of all classes?

0 Answers  


What is the difference between java and .Net?

39 Answers   Bosch,


What is string length in java?

0 Answers  


What are the methods available in a class?

0 Answers  


Categories