public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<String> list = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for(int i = 0; i < 5; i++){
list.add(reader.readLine());
}
list.remove(2);
Collections.reverse(list);
System.out.println(list);
}
}
What is the simplest method to do this task, I know it has something to do with Collections but i cannot get mine to work... a pointer in the right direction please?
Resolved
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Andrew
14 August 2020, 06:39
i got it, thank you very much!
0
Guadalupe Gagnon
13 August 2020, 14:03
You are very close to the solution, however you need to make sure that your code follows all the directions. *hint* the output format is incorrect
0