what is the difference between HashMap And HashTable?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why packages are used?

548


Can singleton class be cloned?

565


What is the final class?

552


2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?

1841


Is ++ operator thread-safe in java?

637






How to create com object in Java?

652


Why is java so important?

654


Why is the singleton pattern considered to be an anti pattern?

480


Write a program to reverse array in place?

595


What is float in java?

565


What is Java Package and which package is imported by default?

602


What is hash code collision?

596


How do you generate random numbers in java?

520


What is the importance of finally block in exception handling?

545


What is final keyword in java?

558