Как удалить элемент в 2D-массиве ⇐ JAVA
-
Anonymous
Как удалить элемент в 2D-массиве
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; //
Источник: https://stackoverflow.com/questions/231 ... a-2d-array
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; //
Источник: https://stackoverflow.com/questions/231 ... a-2d-array