My code should pass all the requirements. I read input and put it in the end of the list. It displays in the input in reverse order. However, it is not passing the requirement. Please let me know what the issue is. Thanks
package com.codegym.task.task07.task0710;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.*;
/*
To the top of the list
*/
public class Solution {
public static void main(String[] args) throws Exception {
ArrayList<String> strings = new ArrayList<String>(
Arrays.asList(null,null,null,null,null,null,null,null,null,null));
String readStr;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (int i =0; i<10; i++)
{
readStr = reader.readLine();
strings.set(9-i,readStr);
}
for(String s:strings)
System.out.println(s);
}
}