How do I read a properties file?
Author: Deron Eriksson
Description: This Java tutorial describes how to read properties from a file.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1
(Continued from page 1)
The ReadPropertiesFile class is executed below. We can see the results of the execution at the bottom of the screen capture.
In the console, the three key/value pairs are displayed. Notice that they are not displayed in the order that they are entered in the properties file. This is because the Properties object is a hashtable, which is a data structure that is optimal for quick storage and retrieval of individual data values, but it does not really have a sense of order to the returned results.