1000 Java Tips ebook
Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!.
Properties class inherited from Hashtable... Does it mean that I can use ''non-s
JavaFAQ Home » Text processing
Question: Properties class inherited from
Hashtable... Does it mean that I can use "non-string" keys and values?
Answer: Not really. Why?
I think best answer for this question can be found in API:
"The Properties class 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
Because Properties inherits from Hashtable, the put and putAll methods can be
applied to a Properties object. Their use is strongly discouraged as they allow
the caller to insert entries whose keys or values are not Strings. The
setProperty method should be used instead. If the store or save method is called
on a "compromised" Properties object that contains a non-String key or value,
the call will fail.
When saving properties to a stream or loading them from a stream, the ISO 8859-1
character encoding is used. For characters that cannot be directly represented
in this encoding, Unicode escapes are used; however, only a single 'u' character
is allowed in an escape sequence. The native2ascii tool can be used to convert
property files to and from other character encodings."
Our older tips: March 22, 2001 - October 21, 2002
All published and not published on site tips you can find
Printer Friendly Page
Send to a Friend
Search here again if you need more info!