Removing a Preference from a Preference Node

This section demonstrates you to remove the preference from a preference node.

Removing a Preference from a Preference Node

This section demonstrates you to remove the preference from a preference node.

Removing a Preference from a Preference Node

Removing a Preference from a Preference Node

     

This section demonstrates you to remove the preference from a preference node. You can see in the given example that in order to remove the preference from the Preference node 'Roseindia', we have used the method clear() of class Preference which removes all of the preferences (key-value associations) from the preference node.

Here is the code of RemovePreference.java

import java.util.prefs.*;
public class RemovePreference{
public static void main(String[] args) throws Exception{
 Preferences prefs = Preferences.userRoot().node("/Roseindia");
 prefs.clear();
 }
}

Download Source Code: