Home » Java programming language

Java System class clearProperty() method with example

System class clearProperty() method: Here, we are going to learn about the clearProperty() method of System class with its syntax and example.
Submitted by Preeti Jain, on September 14, 2019

System class clearProperty() method

  • clearProperty() method is available in java.lang package.
  • clearProperty() method is used to remove or clear the property value denoted by the given argument (property_name).
  • clearProperty() method is static so this method is accessible with the class name too.
  • clearProperty() method may be thrown various type of exception and the exception are given below:
    • SecurityException: If a particular method checkPropertyAcess() does not allow access to the given system property in the method.
    • NullPointerException: If the given system property is null.
    • IllegalArgumentException: If the given system property value is empty.


    public static String clearProperty(String property);


  • property – represents the name of the property to be removed.

Return value:

The return type of this method is String, it returns the old string value of the System property and if there is no property value with that "property_name", it returns null.


// Java program to demonstrate the example of 
// clearProperty() method of System Class.

public class ClearPropertyMethod {
    public static void main(String[] args) {
        // By using  getProperty() method is used 
        // to get the value of the property

        // By using  clearProperty() method is used to 
        // clear the value of the property

        // Display the value of the property
        System.out.println("After clearProperty()...");


E:\Programs>javac ClearPropertyMethod.java
E:\Programs>java ClearPropertyMethod
After clearProperty()...

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.