i really need help with this error. it is an unexpected types error

public class ticTacToeDemo

{
	//use a 3X3 array for the game board.
	private static char[][] board = new char[3][3];

	public static void main(String[] args)
	{
		int turnNumber = 0;
			System.out.println(board[1][1]);
		newGame();
		
		while(!winner())
		{
			turnNumber += 1; 
			if (turnNumber % 2 = 1)
				System.out.println("X's Turn.");
			else
				System.out.println("O's Turn.");
			writeBoard();
			getMove();
		}
	}
}

H:\Java Progs\ticTacToeDemo.java:16: unexpected type
required: variable
found : value
if (turnNumber % 2 = 1)
^

i'm not sure if i posted that quite right, sorry

try this

if (turnNumber % 2 == 1)

when using the = its like assinging a value to a variable...

but what you want to do is compare the values... thats why you use double = like ==

if this works mark as solved.
Thanx

try this

if (turnNumber % 2 == 1)

when using the = its like assinging a value to a variable...

but what you want to do is compare the values... thats why you use double = like ==

if this works mark as solved.
Thanx

oh my god. i knew that. i feel retarded now.

haha its ok.... we all make mistakes :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.