Java tutorial
import java.util.prefs.Preferences; public class Main { public static final String REALKEY = "com.java2s.gui"; public static void main(String[] args) { Preferences p = Preferences.userRoot(); p.put(REALKEY, "bar"); System.out.println(p); System.out.println(p.get(REALKEY, "key")); p = Preferences.systemRoot(); p.put(REALKEY, "key 2"); System.out.println(p); System.out.println(p.get(REALKEY, "default")); } }