I am getting an error the 2nd requirement is not being fulfilled (which is to read 10 integers from the keyboard)
Whereas I am reading 10 integers from the keyboard and even the output is correct.
Then why is this error showing?
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 br = new BufferedReader(new InputStreamReader(System.in));
//write your code here
ArrayList<Integer> list = new ArrayList<Integer>(10);
for (int i=0; i<10;i++) {
int a = Integer.parseInt(br.readLine());
list.add(a);
}
ArrayList<Integer> list2 = new ArrayList<Integer>();
for (int i=(list.size()-1); i>=0; i--) {
list2.add(list.get(i));
}
for (int i=0; i<list2.size(); i++) {
System.out.println(list2.get(i));
}
}
}