Home Java Example Java Util Getting the Maximum Size of a Preference Key and Value
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Getting the Maximum Size of a Preference Key and Value

Advertisement
This section demonstrates you to get the maximum size of Preference key and value.

Getting the Maximum Size of a Preference Key and Value

     

This section demonstrates you to get the maximum size of Preference key and value. You can see in the given example that we have used the fields of class Preferences. The field MAX_KEY_LENGTH provides the maximum length of string for a key and MAX_VALUE_LENGTH provides the maximum length of string for a value.

Here is the code of GetMaximumSize.java

import java.util.prefs.*;

public class GetMaximumSize{
  public static void main(String []args) throws Exception{
  int key= Preferences.MAX_KEY_LENGTH;
  int value = Preferences.MAX_VALUE_LENGTH;
  System.out.println("The maximum length of key="+key +" characters");
  System.out.println("The maximum length of value="+value +" characters");
  }
}

Output will be displayed as:

Download Source Code:

Advertisements

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: January 7, 2009

Ask Questions?    Discuss: Getting the Maximum Size of a Preference Key and Value  

Post your Comment


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