Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Below is what I tried when I to read a properties file and generate a Properties class in Java: 

Properties props = new Properties();

props.load(new FileInputStream(args[0]));

for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {

}

The props.propertyName returns properties that are not in the order of the original properties file. Can anyone tell me how to properly read the properties file in an original order? 

1 Answer

0 votes
by (19.7k points)

Since it uses Hashtable, it’s not possible to obtain the order you have to implement your own Properties class with similar functionalities.

Interested in Java? Check out this Java Certification by Intellipaat.   

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...