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 {

        // Get the system root
        Preferences prefs = Preferences.systemRoot();

        // Get the user root
        prefs = Preferences.userRoot();

        // The name of a root is ""
        String name = prefs.name();

        // The parent of a root is null
        Preferences parent = prefs.parent();

        // The absolute path of a root is "/"
        String path = prefs.absolutePath();
    }
}