what is the difference between HashMap and Hashtable

Answer Posted / tarun kumar

class Hashtable was part of the original java.util and is a
concreate implementation of a Dictionary class. In java2 it
is reengineering it so that it also implements the Map
interface.
Thus it is now integrated into the collections framework.

class HashMap implements Map interface.

Because, Hashtable is a concreate implementation of
Dictionary class, is Legacy class, all legacy classes are
synchronized. So,thats why Hashtable is sunchronized.

I can say that both Hashtable and HashMap are same, accept
synchronization.

Is This Answer Correct ?    22 Yes 25 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between nested and inner class in java.

773


What are the different types of methodologies?

756


How is Object Oriented Programming different from Procedure Oriented Programming?

811


How do you square a number?

869


Is void a type?

759


What is the set interface in java programming?

833


What is a priority queue java?

722


What are the different collection views provided by maps?

760


What does the “static” keyword mean? Can you override private or static method in java?

817


Differentiate between a constructor and a method? Can we mark constructors final?

945


What does it mean that strings are immutable?

860


What is the default size of load factor in hashing based collection?

803


What is the difference between multiple processes and multiple threads?

789


What type of value does sizeof return?

770


What is merge sort in java?

757