How to Get Name and Parent from Preference
From Java Example Source Code
Contents |
[edit] Overview - How to Get Name and Parent from Preference
This Java example program shows how to get name & parent information from Preferences.
[edit] Java Source Code
- Package: example.preferenceproperties
- File: PreferenceExample3.java
package example.preferenceproperties; import java.util.prefs.Preferences; public class PreferenceExample3 { public static void main(String args[]) throws Exception { Preferences prefsRoot = Preferences.userRoot(); Preferences myPrefs = prefsRoot.node("PreferenceExample"); myPrefs.put("A", "a"); myPrefs.put("B", "b"); myPrefs.put("C", "c"); System.out.println("Node's name: " + myPrefs.name()); System.out.println("Node's parent: " + myPrefs.parent()); System.out.println("NODE: " + myPrefs); } }
[edit] What Result You Can Get
Run the program, you will get:
Node's name: PreferenceExample Node's parent: User Preference Node: / NODE: User Preference Node: /PreferenceExample
[edit] Required External Libraries and/or Files for this Java Example
Need nothing.
[edit] How to Run this Java Example Program
We recommend running this Java example program with Eclipse.
For assistance in working with Eclipse, please see How to Run Java Program with Eclipse.
It's fairly easy.
[edit] Question & Answer
Any question?
Click edit and post your question or answer here.
