My code is failing to pass the last two tasks requirements and I do not know what to fix since the code works as expected. Please help?
package en.codegym.task.jdk13.task06.task0634;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/*
Chess board
*/
public class Solution {
public static char[][] array;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int dimention = scanner.nextInt();
boolean isWhite = false;
array = new char[dimention][dimention];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
if(isWhite) {
array[i][j] = ' ';
isWhite = !isWhite;
}
else{
array[i][j] = '#';
isWhite = !isWhite;
}
}
}
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
System.out.print(array[i][j]);
}
System.out.println();
}
}
}