public class AccessProperties {
public static void main(String[] args) {
// Sets the system property indicated by the specified key.
System.setProperty("test", "user.test");
// Gets the system property indicated by the specified key.
System.out.println(System.getProperty("user.home"));
System.out.println(System.getProperty("test"));
// Removes the system property indicated by the specified key.
System.clearProperty("user.home");
System.out.println(System.getProperty("user.home"));
}
}
Output
/Users/myname
user.test
null