You have stumbled upon an issue of scope.
Inside the method, you've declared a completely different variable, also called number. This is the variable that you are giving the "guess" value, and when your method has finished and goes out of existence, so does this value. All you have left to access is your instance variable, which was never given a value at all, and which happens to default to zero.
So your game should be over pretty quickly if the number to guess is 0, since all the players get it right the first time!
There are a couple of things you could experiment with:
1) inside your method, instead of saying "int number", try using "this.number"
this refers to "the object to which I belong". Since each player has their own guess() method, then that method would know to look for a variable inside that particular instance of the class.
2) remove the type declaration inside your method. That is to say, use
instead of
[ May 24, 2008: Message edited by: Katrina Owen ]