I'm new to Java and is trying to learn the class Properties. I have came up with the code below. However, when I run the code, I noticed that the three properties store in random.txt is in the reverse order of code execution. Why is this the case? Could someone please enlighten me? Thanks in advance for any help!
Properties p1 = new Properties();
try (OutputStream os1 = new FileOutputStream("random.txt")){
p1.setProperty("1", "one");
p1.setProperty("2", "two");
p1.setProperty("3", "three");
p1.store(os1, "comment");
} catch(IOException e){
e.printStackTrace();
}