Removing a Preference Node

This section demonstrates you to remove the Preference node

Removing a Preference Node

This section demonstrates you to remove the Preference node

Removing a Preference Node

Removing a Preference Node

     

This section demonstrates you to remove the Preference node. You can see in the given example that firstly you have to get the specified node using the method userRoot().node("/Roseindia Employees") method. Then use the removeNode() method of Preferences class which removes this preference node and all of its descendants, invalidating any preferences contained in the removed nodes.

Here is the code:

import java.util.prefs.*;
import java.io.IOException;
public class RemoveNode{
  public static void main(String[] args)throws IOException, BackingStoreException {
  Preferences prefs = Preferences.userRoot().node("/Roseindia Employees");
  prefs.removeNode();
  }
 }

Download Source Code: