In this section, you will learn how to get all keys and values of the properties files in the Java. This section illustrates the way for getting all keys and corresponding values of the properties file through an example. The example is given bellow.
Description of program:
Here, you will get all keys and values of the properties files with the help of this program. The program shows the keys and values when you run it.
The following methods are explained as follows which have been used in the program.
This method returns a set of keys, which contains in the Properties method.
This method provides the all keys of the properties files stored in the Enumeration.
It's the interface provided by the java.util package. Enumeration implements a series of elements and calls the nextElements method, which provides a series of elements. The keys and values of the properties files that are enumerated in this interface calls by hashtable, which defines the keys and values of the properties files.
This method checks the Enumeration that has one more elements or not with returns true or false. If it returns true, then the Enumeration object has more than one element, otherwise it return false.
This is the method to return the next elements of the Enumeration. If the enumeration provides the more than one elements,
Here is the code of program: