import java.util.prefs.PreferenceChangeEvent;
import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
public class Main {
public static void main(String[] argv) throws Exception {
Preferences prefs = Preferences.userNodeForPackage(String.class);
prefs.addPreferenceChangeListener(new PreferenceChangeListener() {
public void preferenceChange(PreferenceChangeEvent evt) {
Preferences node = evt.getNode();
String key = evt.getKey();
String newValue = evt.getNewValue();
}
});
prefs.put("key", "a string");
prefs.put("key", "a new string");
prefs.remove("key");
}
}