what is the difference between HashMap and Hashtable

Answer Posted / ashad

Hash Table is a legacy Class Whereas HashMap belongs to the
collections package.

HashMap allows null key and values..but it allows only one
null key and multiple null values...Whereas the HashTable
wont allow the null key and values..


HashMap allows only one null key, basic idea behind it is
that key can have unique value only if one null is assigned
to a key next null will be duplicate.

Is This Answer Correct ?    10 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the access scope of protected access specifier?

528


Is an array a vector?

544


Is stringwriter thread safe?

540


Differentiate between the constructors and methods in java?

497


What is type inference in java8?

571






What is an abstract class and what is it’s purpose?

529


describe synchronization in respect to multithreading? : Java thread

491


Can we sort a map in java?

570


What is blank final variable?

557


Why do we need autoboxing in java?

509


What do you mean by exception handling in Java?

652


What is the purpose of using javap?

604


Difference between final and effectively final ? Why is effectively final even required ?

544


Which browsers work with java?

554


What is a arraylist in java?

546