Java Utility Library

Java.util.Properties Class



Java Properties Class

Java.util package provides a Properties class which represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string. A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list. This class is thread-safe: multiple threads can share a single Properties object without the need for external synchronization.

Class declaration

The declaration of java.util.Properties class is:

public class Properties
  extends Hashtable<Object,Object>

Fields

S.NField and Description
1. protected Properties defaults
A property list that contains default values for any keys not found in this property list.

Class Constructors

S.NConstructors & Description
1. Properties()
Creates an empty property list with no default values.
2. Properties(Properties defaults)
Creates an empty property list with the specified defaults.

java.util.Properties Methods

The java.util.Properties class has a number of methods which are listed below:

Member Methods

S.NMethods & Description
1. void list(PrintStream out)
Prints this property list out to the specified output stream.
2. void list(PrintWriter out)
Prints this property list out to the specified output stream.

Methods inherited

This class inherits the methods of following class:

  • java.lang.Object
  • java.util.Dictionary<K,V>
  • java.util.Hashtable<Object,Object>