I finally managed to do this task (so I'm not able to place the solution here). But I could do it only by searching the help topics, and I didn't really understand neither the conditions, nor the solution. And in the topics I didn't find any explanation of the conditions, only partial answers to the solution.
1. So, what does "Add 10 strings to it from the keyboard, but only add them to the beginning of the list, not the end." mean? Does that mean that the list must be inverted? Why? For me, that's not clear (maybe it's problem with the English language, who knows).
2. In the code bellow, what is the purpose of the "list.add(0, s);"? Am I adding an element at the beginning of the array? Why?
for(int i = 0; i < 10; i++) {
String s = reader.readLine();
list.add(0, s);
}
3. In the code bellow, why does the output come inverted?? For me, that makes no sense xD
for(int i = 0; i < list.size(); i++){
System.out.println(list.get(i));
}
Input:
grandfather
grandmother
father
mother
son
daughter
cat
dog
program
car
Output:
car
program
dog
cat
daughter
son
mother
father
grandmother
grandfather
--
Hope someone can help me on this task, which was supposed to be "easy".
Thanks!
:D