Difference between Hash Table and Hash Map?

Answers were Sorted based on User's Feedback



Difference between Hash Table and Hash Map?..

Answer / ranganathkini

Hashtable and HashMap are more less similar to each other
except that the HashMap is unsynchronized and allows nulls
whereas Hashtable is synchronized and does not permit nulls.

Is This Answer Correct ?    27 Yes 2 No

Difference between Hash Table and Hash Map?..

Answer / arun kumar rout

hashtable is Synchronised where as hashmap is not.

Is This Answer Correct ?    17 Yes 2 No

Difference between Hash Table and Hash Map?..

Answer / ravikiran

HashTable is the collection which is legacy.Which doenn't
allows null keys and null values.And methods access is
synchronized.
HashMap is the collection which can allow one null key and
multiple null values.And methods access is not synchronized.

Is This Answer Correct ?    12 Yes 2 No

Difference between Hash Table and Hash Map?..

Answer / guest

Hash Table is synchronized but Hash Map is not. Means Hash
Map allow Null value for key and value but Hash Table does
not allow.

Is This Answer Correct ?    7 Yes 5 No

Difference between Hash Table and Hash Map?..

Answer / guru

hashtable is Synchronised where as hashmap is not.
hash table are legacy classes hashmap are collections

Is This Answer Correct ?    4 Yes 2 No

Difference between Hash Table and Hash Map?..

Answer / guest

HashTable is synchronized where as HashMap is not.
HashMap allows null values for (key,value) for only once
where as HashTable does not.

Is This Answer Correct ?    2 Yes 0 No

Difference between Hash Table and Hash Map?..

Answer / hemasankar reddy suggu

1)Hashtable method all are synchronized where as HashMap
does not Synchornized all methods
2)HAshtable object is thread safe where HashMap object is
not thread Safe
3)Hashtable perfomance is low where Hashtable performance is
High
4)null is not allowed in Hashtable but HAshMap null is allowed
5)Hashtable is Interduced in 1.0V where HashMap interduced
in 1.2V

Is This Answer Correct ?    1 Yes 1 No

Difference between Hash Table and Hash Map?..

Answer / anand

HashTable is the collection which is legacy.Which doenn't
allows null keys and null values.And methods access is
synchronized.
HashMap is the collection which can allow one null key and
multiple null values.And methods access is not synchronized.

Is This Answer Correct ?    2 Yes 5 No

Difference between Hash Table and Hash Map?..

Answer / devendra.m

HashMap and HashTable both are equal...
HashMap is non-synchronized one,where as HashTable
synchronized one.
HashMap allows null as a key & value pair.
where as hashtable wont allows null as key & value pair.

Is This Answer Correct ?    1 Yes 6 No

Difference between Hash Table and Hash Map?..

Answer / santosh nayak

HashMap hm=new HashMap();
hm.put("s","s");
hm.put("a","a");
hm.put(null,"r");
hm.put(null,"t");
hm.put("e","e");

This is the code where we can allow multiple null key values
in HashMap.

Is This Answer Correct ?    1 Yes 12 No

Post New Answer

More Core Java Interview Questions

why the constructor should be used in class,if there is no constructor what will happen?

4 Answers  


What are the parameters used in Connection pooling?

1 Answers   IBM,


What is parsing in grammar?

0 Answers  


What is a boolean field?

0 Answers  


while creating thread why we extend thread class

2 Answers  






What is the main difference between java platform and other platforms?

0 Answers  


public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod

4 Answers   TCS,


What are the Abstract Classes provided by Java?

5 Answers   Oracle,


how many types of cloning?

4 Answers   Mobily,


How do you square a number?

0 Answers  


What is boolean strategy?

0 Answers  


What does a void function return?

0 Answers  


Categories