Received: "The task failed to pass testing: Be sure that the program compares arrays using the deepEquals method of the Arrays class."
But I am using Arrays.deepEquals in the 30th line of code.
Please help me understand what I'm doing wrong.
package en.codegym.task.jdk13.task06.task0635;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.OptionalInt;
import java.util.Random;
/*
QR-code reader
*/
public class Solution {
public static String[][] expectedArray = new String[3][3];
public static String[][] actualArray = new String[3][3];
static {
Random random = new Random();
for (int i = 0; i < expectedArray.length; i++) {
for (int j = 0; j < expectedArray[0].length; j++) {
OptionalInt optionalInt = random.ints(0, 2).findFirst();
expectedArray[i][j] = optionalInt.isPresent() && optionalInt.getAsInt() == 1 ? " " : "#";
}
}
}
public static void main(String[] args) throws IOException {
fillActualArrayFromKeyboard();
boolean result = Arrays.deepEquals(expectedArray, actualArray);
System.out.println(result);
}
public static void fillActualArrayFromKeyboard() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < actualArray.length; i++) {
for (int j = 0; j < actualArray[0].length; j++) {
actualArray[i][j] = reader.readLine();
}
}
}
}