in Technology by
What is the difference between HashMap and Hashtable in JAVA?

1 Answer

0 votes
by
No. HashMap Hashtable
1) HashMap is not synchronized. Hashtable is synchronized.
2) HashMap can contain one null key and multiple null values. Hashtable cannot contain any null key or null value.
3) HashMap is not ?thread-safe,? so it is useful for non-threaded applications. Hashtable is thread-safe, and it can be shared between various threads.
4) 4) HashMap inherits the AbstractMap class Hashtable inherits the Dictionary class.

Related questions

0 votes
    What is the difference between HashMap and TreeMap in JAVA?...
asked May 26, 2021 in Technology by JackTerrance
0 votes
    What is the difference between HashSet and HashMap in JAVA?...
asked May 26, 2021 in Technology by JackTerrance
0 votes
    What is hash-collision in Hashtable and how it is handled in Java?...
asked May 27, 2021 in Technology by JackTerrance
0 votes
0 votes
    Why is Dictionary preferred over Hashtable in C#?...
asked Jan 16, 2021 in Technology by JackTerrance
0 votes
    When I iterate over the values or keys are they going to correlate? Will the second key map to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes? (a) Map (b) ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes? (a) Map (b ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    What happens if we put a key object in a HashMap which exists? (a) The new object replaces the ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Is hashmap an ordered collection. (a) True (b) False I had been asked this question during an ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    If two threads access the same hashmap at the same time, what would happen? (a) ConcurrentModificationException ... and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    What is a Hashtable in C#?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    What is the difference between the length of an Array and size of ArrayList in Java?...
asked May 27, 2021 in Technology by JackTerrance
0 votes
    What is the difference between Collection and Collections in JAVA?...
asked May 26, 2021 in Technology by JackTerrance
0 votes
    What is the difference between Set and Map in JAVA?...
asked May 26, 2021 in Technology by JackTerrance
...