error: bad operand types for binary operator ‘&&’

You need to use the relational operator == instead of =. Each of the 3 sub-statements within the parentheses of your if statement should represent a boolean. In Java, = is used to assign a value and == is used to check equality. Therefore, you must change your if statement to:

if((board[z][i] == 1) && (board[z][i++] == 1) && (board[z++][i] == 1)){

Also, rather than incrementing z and i by 1 (because you are already doing that as part of your for loop), maybe make i++ –> i + 1 and z++ –> z + 1.

Hope this helps!

Leave a Comment