Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Example Java Util Example Using put() method

Related Tutorials


 
 

Share on Google+Share on Google+

Example Using put() method

Advertisement
In this example you will learn that how a put function is used in the program, in this example first time when it initialize it don't have any value but when we give some of the value in it by put() function then it will show the value what it have in its

Example Using put() method

     

 

In this example you will learn that how a put function is used in the program, in this example first time when it initialize it don't have any value but when we give some of the value in it by put() function then it will show the value what it have in its container.

 

Here is the Complete Code of the Example :

import java.util.prefs.Preferences;

public class put 
  {
  public static void main(String[] args
  {

 
  Preferences prefs = Preferences.userNodeForPackage(put.class);

 
  String x = prefs.get("one"" ");

  System.out.println(x);
  
  prefs.put("one""roseindia");

  }

 }

After thoroughly knowing the code you should save the file by "put.java" file name and when after compiling the code you run your program you will get the output given below .

Here is the Output of the Example :


C:\anshu>javac put.java

C:\anshu>java put
roseindia

Downoload this example.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 27, 2008

Related Tutorials

Discuss: Example Using put() method  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com