Doesn't appear this question posted on the first try, so I am trying again.
Could somebody please tell me what is wrong with my code?
I am getting this error when I try to verify: Be sure that you just display the array in reverse order. You don't need to reverse the order of the elements in the list.
I've looked at the other help questions and I believe my code looks basically the same as others' code.
What am I not seeing?
package com.codegym.task.task07.task0719;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Display numbers in reverse order
*/
public class Solution
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//write your code here
ArrayList<Integer> list = new ArrayList<Integer>();
int n;
String s;
for(int i = 0; i <= 10; i++)
{
s = reader.readLine ( );
list.add(Integer.parseInt(s));
}
n = list.size();
for(int j = n-1; j >= 0; j--)
{
System.out.println(list.get(j));
}
}
}