I was doing a Tic Tac Toe game assignment but my board did not turn out as I want it to. I am attaching a picture of how I want my board to like along with the part of the code I need help with.
I think the error is in this part of the code:
public void printBoard() {
char a = 'A';
char b = 'B';
char c = 'C';
System.out.println(" 1 2 3 ");
System.out.println(" ");
for (int i = 0; i < board.length; i++) {
if (i == 0)
System.out.print(" " + a + ' ');
else if (i == 1)
System.out.print(" " + b + ' ');
else if (i == 2)
System.out.print(" " + c + ' ');
for (int j = 0; j < board[i].length; ++j) {
System.out.print("|");
System.out.print(" " + board[i][j] + ' ');
if (j + 1 == board[i].length)
System.out.println("|");
}
System.out.println(" |---|---|---|");
}
System.out.println();
}

