Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

properties
java
file

Java properties file

Educative Answers Team

A Java properties file is used to store configuration data or settings for a Java project. .properties is a file extension for files that​ store the configurable parameters of an application.

Recompilation is not required if modifications are made to a properties file.

If any information is changed in the properties file, the Java class does not need to be recompiled; hence, a properties file is usually used to store information that is frequently changed.

svg viewer

Each parameter is stored as a pair of strings; one string stores the name of the parameter and the other stores its value. These strings are similar​ to key-value pairs.

Example

Suppose that there is a Java class that takes the username and password of a user along​ with the IP address of the server that the user wants to connect to. The properties file for this class will store the three parameters as:

username=Hassan
password=Educative_1331
ip_address=192.168.1.3

The program can now ​read these parameter values from this properties file.

RELATED TAGS

properties
java
file
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring