'What is the difference between a Hashtable and Properties?

What is the difference between a Hashtable and Properties?



Solution 1:[1]

Properties is a very specialized class that's designed to hold configuration and/or resources that are usually stored in some file.

It has several features that Hashtable doesn't have (and shouldn't have):

A Hashtable on the other hand is a general-purpose Map implementation (which is mostly replaced by the HashMap, however).

Solution 2:[2]

Properties is a subclass of Hashtable, and it is designed for string to string mappings. It also adds the ability to store the mapping into a text file, and read it back.

Solution 3:[3]

1.Properties is the subclass of Hashtable. It is more like a map which stores key value pair.

2.In properties both key and value are string

3.In properties we can store the key and value pair in a properties file .

4.Properties class has the ability to load and save the properties file while Hashtable doesn't have this method.

5.Properties files are mostly used to store configuration or localization data. They are used to externalize the data which is configurable to the application.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joachim Sauer
Solution 2 Eyal Schneider
Solution 3 Deepak Silver