Properties file in Java

In this section, you will know about the properties file. The properties file is a simple text file.

Properties file in Java

In this section, you will know about the properties file. The properties file is a simple text file.

Properties file in Java

Properties file in Java

     

In this section, you will know about the properties file. The properties file is a simple text file. Properties file contains keys and values for the specific key. Keys of properties file is always on left side and it's value is on the right side. Keys and values are separated by equal(=) sign. It is most important for the hash table. All the properties file are saved with the ".properties" extension. 

Properties class:
java.util.properties class extends the java.util.Hashtable class. This class is used to save the properties to the stream and read the properties from the stream. You can use the properties file to store the configurable values like database connection string, user name and password instead of hard coding into the program. 

Here, keys and values are specified in the properties file as follows:

#Mon Oct 23 15:16:21 GMT+05:30 2006
vk=Rosé.Net
RI=RoseIndia.Net
23 =Delhi
D =Deepak Kumar
Message= Software Development works