Close

Java - System.clearProperty() Examples

Java Java API 


Class:

java.lang.System

java.lang.Objectjava.lang.Objectjava.lang.Systemjava.lang.SystemLogicBig

Method:

public static String clearProperty(String key)

Removes the system property indicated by the specified key.


Examples


package com.logicbig.example.system;

public class ClearPropertyExample {

public static void main(String... args) {
String property = System.getProperty("user.language");
System.out.printf("before clearProperty() : %s%n", property);

String s = System.clearProperty("user.language");
System.out.printf("clearProperty() returned : %s%n", s);

property = System.getProperty("user.language");
System.out.printf("after clearProperty() : %s%n", property);
}
}

Output

before clearProperty() : en
clearProperty() returned : en
after clearProperty() : null




See Also