Java Reference
In-Depth Information
21.16. Properties
A Properties object is used to store string keys and associated string
elements. This kind of hashtable often has a default Properties object
in which to look for properties that are not specified in the table itself.
The Properties class extends Hashtable<Object,Object> . Standard Hashtable
methods are used for almost all manipulation of a Properties object, but
to get and set properties, you can use string-based methods. In addi-
tion to inherited methods, the following methods and constructors are
provided:
public Properties()
Creates an empty property map.
public Properties(Properties defaults)
Creates an empty property map with the specified default Prop-
erties object. If a property lookup fails, the default Properties
object is queried. The default Properties object can have its
own default Properties object, and so on. The chain of default
objects can be arbitrarily deep.
public String getProperty(String key)
Gets the property element for key . If the key is not found in
this object, the default Properties object (if any) is searched.
Returns null if the property is not found.
public String getProperty(String key, String defaultElement)
Gets the property element for key . If the key is not found in
this object, the default Properties object (if any) is searched.
Returns defaultElement if the property is not found.
 
Search WWH ::




Custom Search