• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Guess Game in Head first Java error

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I fixed the spelling error but the error message still continues.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So if were to declare startGame what would I do to Start the game.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Woops my bad Thanks A lot.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic