The 2d boolean is a static variable if that means anything. I thought that I could refer to just the name of the array, but I get an error for doing that.
public class Game {
static boolean[][] board = new boolean[3][3];
}
public class Computer
{
if (Game.board = true)
{
//code
}
}
if(Game.board = true)will throw a compiler error becauseboardis a two-dimensional array and thus cannot be assigned a singlebooleanvalue.Also, when comparing make sure you use the comparison operator
==Perhaps, you want to do something like:
if(Game.board[i][j] == true)whereiandjare indexing the array:You have
boarddeclared asstatic, any particular reason?Since
board[i][j]returns abooleanvalue, there really isn’t a need for the== true: