How to Write Data to Properties file using Java Code

preview_player
Показать описание
Hello

In this tutorial, I will show you How to write the data to a properties file in XML format Java | Selenium

2. It can be used to get property value based on the property key. The Properties class provides methods to get data from the properties file and store data into the properties file.

3. If any information is changed from the properties file, you don't need to recompile the java class. It is used to store information that is to be changed frequently.

Methods:

Properties(): It creates an empty property list with no default values.

Store(): Writes this property list (key and element pairs) in this Properties

Fileoutputstream(): A file output stream is an output stream for writing data to a File

Please do subscribe for more tutorials on selenium automation @SH Study Tech

Please share questions and queries in the comments section.

Follow me on Twitter: shstudy

Рекомендации по теме
Комментарии
Автор

It was a very short code. Cool. I am looking for something to insert data in properties file.
By Insert I mean, not deleting old keys and values and adding new keys and values.
Do you know how cam I do it?

josephsky
visit shbcf.ru