I'm working on a tic tac toe game. I wrote a code to print a board, it holds underscore brackets for empty spaces of a 2D array. Does anyone know a way I could not have the underscore bracts print for the last line? Xs and Os are stored as Strings "X" and "O" Thanks!
public void PrintBoard()
{
System.out.println();
for (int i = 0; i < board.length; i++)
{
for (int j = 0; j < board.length; j++)
{
if (board[i][j] == null)
System.out.print("___");
else
System.out.print(board[i][j]);
if (j < 2)
System.out.print("|");
else
System.out.println();
}
}
System.out.println();
}
This line
Should be
Also, I'd probably change the loop a bit...
And then add a println after that inner loop.