Hello, I keep failing the condition "The program should display 10 strings, each on a new line.". In IntelliJ, it does display 10 strings, and this is the final output if my inputs are string1,string2, etc.:
Peter Bishop Walter Bishop string8 string7 string6 string5 string4 string3 string2 string1-Perhaps I am failing because every time I enter one of the strings, it displays the 10 strings, however, any unknown strings in the array display as null. Could this be the problem? Thanks in advance for the help!
package com.codegym.task.task07.task0702;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
String array in reverse order
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String[] array = new String[10];
for (int i = 0; i < 8; i++) {
array[i] = read.readLine();
{
array[8] = "Walter Bishop";
array[9] = "Peter Bishop";
for(int j = 10 - 1;j >= 0; j--) {
System.out.println(array[j]);
}
}
}
}
}