Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.prefs.Preferences;

public class Main {
    public static void main(String[] argv) throws Exception {
        boolean exists = Preferences.userRoot().nodeExists("/yourValue"); // false
        if (!exists) {
            Preferences prefs = Preferences.userRoot().node("/yourValue");
            prefs.removeNode();
            // prefs.removeNode();
        }
        Preferences prefs = Preferences.userRoot().node("/yourValue/child");
        exists = Preferences.userRoot().nodeExists("/yourValue"); // true
        exists = Preferences.userRoot().nodeExists("/yourValue/child"); // true

        Preferences.userRoot().node("/yourValue").removeNode();

        exists = Preferences.userRoot().nodeExists("/yourValue"); // false
        exists = Preferences.userRoot().nodeExists("/yourValue/child"); // false
    }
}