In this example you will learn how can a user change the preferences value by the user value. Here we are going to make it easier to understand by the complete example on this topic. In the given example we explain a simple way for using the get() and put() method in preferences. In preferences the get() is the most useful method with the help of which you can stored data in the class and can change by put() method. In this example the value which is stored by get method will display only one time but then after the value will show the user value when you run it second time. If we consider the example the first time when you run the example it shows the value it stored "deepak" , and "rinku" but when you run the same program it will display the user information "rose" and in the second line it will show "india".
Just save the example as "base.java"
C:\Documents and Settings\Microsoft\Desktop>java base
In the output it clearly shows that on the first compilation and running time the value is as in the get method but when it compiled second time the value change as "rose" and "india"
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: java preferences,Change the value of Preferences by user
Post your Comment