Код: Выделить всё
public static void placeMove(int num1, int num2){
//checking if x and y are greater than rows and columns of a 2D array
if(num1 > rows-1 || num2 > columns-1){
System.out.println("This space is off the board, try again.");
int[] values = new int[2];
values = inputMove(); //calls inputMove method to ask user for new input
placeMove(values[0],values[1]); //calling itself to check
//if new values are prohibited
}
//code to place a value in grid[num1][num2]
}
< /code>
У меня есть 2D -массив (размер строк и столбцов варьируется в зависимости от настроек): < /p>
char[][] grid = new char[rows][columns];
Подробнее здесь: https://stackoverflow.com/questions/450 ... ethod-call
Мобильная версия