• 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

GuessGame- 2 of my methods cannot be resolved to a variable or is not a field

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I am new to Java. I should note that I did not compile these, which I know how to do but I've been using Eclipse and I realized that it compiles stuff into class files for you. So, I created a new project and each class is a separate .java file, with the .class files already there, but I cannot get rid of these errors. Does the order in which I make the files matter? Or, say if I wrote them all into one file and then realized it needs to be 3 separate, or that all need to be in the same src file (oops)? Already deleted the old stuff... Help!

Here are the errors:

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
random cannot be resolved or is not a field
guessp1 cannot be resolved to a variable
guessp1 cannot be resolved to a variable
guessp2 cannot be resolved to a variable
guessp2 cannot be resolved to a variable
guessp3 cannot be resolved to a variable
guessp3 cannot be resolved to a variable
guessp1 cannot be resolved to a variable
guessp2 cannot be resolved to a variable
guessp3 cannot be resolved to a variable

at GuessGame.startGame(GuessGame.java:25)
at GameLauncher.main(GameLauncher.java:5)


And here is the code:

 
Ranch Hand
Posts: 146
1
IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I skimmed -

You've declared,



But you are using guessp1, guessp2 & guessp3.
 
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Clint,

Check this page > UseCodeTags it is a critical part of code readability.

And welcome to the Ranch
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I put the code tags in for you this time. Also, break up long lines into shorter one. About 80 characters is a good goal.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic