The following program demonstrates An Example of the Properties Class in Java.
Basically, the Properties class represents a key-value pair where both the keys and values are of the type String. In the following program, we use the Properties class to display the properties of standard output (System.out), and standard error (System.err). Also, the value of the property user.name is also displayed.
import java.util.*;
public class PropertiesDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
Properties pob=System.getProperties();
pob.list(System.out);
pob.list(System.err);
System.out.println(pob.getProperty("user.name"));
}
}
Output