• Post Reply Bookmark Topic Watch Topic
  • New Topic

Guess Game in Head first Java error  RSS feed

 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm trying to the guess game in the book Head First Java and I have stumbled upon a problem I have three pieces of code:
The error occurs when the compiler reaches the gamelauncher class it says:

File: C:\Users\Craig\Documents\Java Fresh\GuessGame.java [line: 41]
Error: C:\Users\Craig\Documents\Java Fresh\GuessGame.java:41: cannot find symbol
symbol : variable p2isRgiht
location: class GuessGame

Can anyone help me please.
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another problem I have is to get the code into the right format when making a post how do i do that
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig E. Lewis wrote:Another problem I have is to get the code into the right format when making a post how do i do that

UseCodeTags
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig E. Lewis wrote:
Error: C:\Users\Craig\Documents\Java Fresh\GuessGame.java:41: cannot find symbol
symbol : variable p2isRgiht

Is that the right spelling of the variable name ?
 
Abhishek Khanna
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have defined the variable as p2isRight, but you are accessing it with the name p2isRgiht.
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I fixed the spelling error but the error message still continues.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig E. Lewis wrote:Well I fixed the spelling error but the error message still continues.

What? The same error? On the same line?

Winston
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My bad the new message is:

File: C:\Users\Craig\Documents\Java Fresh\GameLauncher.java [line: 4]
Error: C:\Users\Craig\Documents\Java Fresh\GameLauncher.java:4: cannot find symbol
symbol : method startGame()
location: class GuessGame

Hope you can help me.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig E. Lewis wrote:Hope you can help me.

Have a look at line 3 again. CAREFULLY.

Java (and almost no language) is forgiving about misspellings, so be extra careful when you're typing.

Winston

PS: I've added code tags for you. See how much better it looks? As Stuart said, read the UseCodeTags (←click) page.
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry for pestering you but if you meant that Game in the third line wasn't capitalized, I capitalized it in the third and fourth line in the "Game".startGame. It gives me the error message
cannot find symbol: method startGame().
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't find that method either. (I used Ctrl-F in the browser to search for it.) Perhaps you could point out where in the Game class you think it is?
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So if were to declare startGame what would I do to Start the game.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig E. Lewis wrote:I'm sorry for pestering you but if you meant that Game in the third line wasn't capitalized...

No I didn't; and my apologies - I should have said line 5 (at least from what you posted).

Basically, you need to look at the error message really thoroughly, because it tells you exactly what to look for.

Winston
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still haven't understood in line five there is only a curly bracket.
 
Craig E. Lewis
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Woops my bad Thanks A lot.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!