what is difference betwwen hashmap and hashtable ?

Answers were Sorted based on User's Feedback



what is difference betwwen hashmap and hashtable ?..

Answer / deep pratap singh

HashMap HashTable
1> Not Synchronized Synchronized
2> can contain null cann't

You may also make HashMap Synchronized using generic
methods. Using Hashtable is bad habit. Try to avoid it.

Is This Answer Correct ?    10 Yes 2 No

what is difference betwwen hashmap and hashtable ?..

Answer / ravikiran

hashmap allows one null key and multiple null values.
hashtable doesn't allow null elements
hashmap is not synchronized
hashtable is snchronized
hashmap is not legacy
hashtable is legacy

Is This Answer Correct ?    6 Yes 0 No

what is difference betwwen hashmap and hashtable ?..

Answer / ajay yadav

Hash Map allows null values.
Hash Table dont allows null values.

Is This Answer Correct ?    4 Yes 0 No

what is difference betwwen hashmap and hashtable ?..

Answer / javablossom

The Iterator is used in the hashmap is fail-safe and
whereas the Enumerator used in hashtable is not fail-safe.

Is This Answer Correct ?    1 Yes 0 No

what is difference betwwen hashmap and hashtable ?..

Answer / sekhar

Both class are under map interface.But hash table is
synchronized.hashMap is not.we can explictly synchronize
hash map by using the method
Collections.synchronizedMap(Hash Map);

Is This Answer Correct ?    1 Yes 1 No

what is difference betwwen hashmap and hashtable ?..

Answer / kvn

Hash map contains null values,but hash table does not.

Is This Answer Correct ?    1 Yes 3 No

what is difference betwwen hashmap and hashtable ?..

Answer / guest

dfg

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More Core Java Interview Questions

What is multi level inheritance in java?

0 Answers  


What modifiers are allowed for methods in an interface?

0 Answers  


Where are local variables stored?

0 Answers  


Explain about narrowing conversion in java?

0 Answers  


How to declare an arraylist in java?

0 Answers  






How can we make copy of a java object?

0 Answers  


What is percentage in java?

0 Answers  


For ease of programming you can consider the maze as a 2D array with colors represented by below integer and characters (in capital letters). • B - Black • W -White • G- Green • R- Red R B W B W W W W W W B W B B W W W W W W W B W B W W W B W W W W B B W W W B W W W B W W B B B B W B W B W W B W W W B W W W B B B W W B W W W B W W B W B W W W B W B W W W W B B W W W W B W W W W W G Shortest Route Problem: • Solution that finds the shortest Route between Red and Green  White will have 1 Weight.  Red and Green carry no weights.  Shortest path is the path with less weight when you add up the weights in the path.

0 Answers  


Can there be an abstract method without an abstract class?

0 Answers  


Are maps ordered java?

0 Answers  


How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ?

1 Answers   Saksoft,


what is the difference between a java object reference and c++ pointer?

4 Answers  


Categories