What to do in 3 requirement?? Pls help Reply ASAP
package com.codegym.task.task07.task0710;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
To the top of the list
1. Create a list of strings in the main method.
2. Add 10 strings to it from the keyboard, but only add them to the beginning of the list, not the end.
3. Use a loop to display the contents, each value on a new line.
Requirements:
1. Declare a string list variable and immediately initialize it.
2. The program should read 10 strings from the keyboard and add them to the list.
3. The program should add lines to the beginning of the list.
4. The program should display the list, each value on a new line.
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
ArrayList<String> list = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int j = 1;
for(int i=0;i<10;i++){
list.add(i,reader.readLine());
}
for (int i=list.size()-1;i>=0;i--)
{
System.out.println(list.get(i));
}
}
}