Properties
Properties in the collections framework are used to maintain lists of key-value pairs where both are of the String
class. Properties are relevant when obtaining environmental values from the operating system, for example, and are the grounding class for many other classes. One of the main characteristics of the Properties
class is that it allows the definition of a default response in the case of a search for a certain key not being satisfactory. The following example highlights the basics of this case:
Example20.java
1 import java.util.*; 2 3 public class Example20 { 4 5 public static void main(String[] args) { 6 Properties properties = new Properties(); 7 Set setOfKeys; 8 String key; 9 10 ...