read a value from properties file using java
Create a property file with values
userName = “test”
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
public class GetDataFromProperties {
public static void main(String[] args) throws IOException {
Properties prop = new Properties();
FileInputStream fileInput = new FileInputStream(
"give the property file path");
prop.load(fileInput);
System.out.println(prop.getProperty("userName"));
}
}
No images available.