I have a 2D array that I need to "reset" each time a tic tac toc game is started. I call a method and loop through the array setting all the elements to Zero. But this defeats the purpose of my program because i need to have all the elements empty/null again.
public static char[][] initializeGame(char[][] gameBoard) {
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 3; col++) {
gameBoard = null; //<--THIS IS THE THING AM TRYING TO NULL @ gameBoard[row][column]
}
}
return gameBoard;
}
How can I set the elements of gameBoard
to null?