• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Cannot find symbol

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to Java and relatively new to programming in general. Currently I'm reading the book 'Head First Java' and am stuck on this piece of code from chapter two.

Every time I try to compile it, it comes up with an error.

Anyway, here's the code:








I type javac *.java to compile it
And here's the error it keeps throwing up:

GuessGame.java:48: error: cannot find symbol
if (p1isright || p2isright || p3isright) {
^
symbol: variable p1isright
location: class GuessGame
GuessGame.java:48: error: cannot find symbol
if (p1isright || p2isright || p3isright) {
^
symbol: variable p2isright
location: class GuessGame
GuessGame.java:48: error: cannot find symbol
if (p1isright || p2isright || p3isright) {
^
symbol: variable p3isright
location: class GuessGame
GuessGame.java:51: error: cannot find symbol
System.out.println("Player one got it right?" + p1isright);
^
symbol: variable p1isright
location: class GuessGame
GuessGame.java:52: error: cannot find symbol
System.out.println("Player two got it right?" + p2isright);
^
symbol: variable p2isright
location: class GuessGame
GuessGame.java:53: error: cannot find symbol
System.out.println("Player three got it right?" + p3isright);
^
symbol: variable p3isright
location: class GuessGame
6 errors

Any help would be appreciated.
Thanks!
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java is case sensitive
 
Jacob Milligan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm... Well I feel a bit silly now. I didn't even notice that.

Thanks!
 
Marshal
Posts: 79952
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch Lots of people get confused like that.
 
Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic