Java System clearProperty() Method

The clearProperty() method of Java System class removes the system property indicated by the specified key.

Syntax

Parameters

Key - Removes the name of System property

Returns

  1. The previous string value of the system property.
  2. If there was no property with that key then it will return null.
  3. If Key is null then a NullPointerException is thrown.
  4. If key is empty then an IllegalArgumentException is thrown.

Example 1

Output:

Before using clearproperty = E:\Practicecorejava\FirstThisDemo\bin;E:\mysql jar file\com.mysql.jdbc_5.1.5.jar
After using clearproperty = null

Example 2

Output:

Default Property = E:\Practicecorejava\FirstThisDemo
New Property = JavaTpoint