• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Clint Kashevos
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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:

 
Quazi Irfan
Ranch Hand
Posts: 104
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I skimmed -

You've declared,



But you are using guessp1, guessp2 & guessp3.
 
Liutauras Vilda
Sheriff
Posts: 4916
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Clint,

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

And welcome to the Ranch
 
Knute Snortum
Sheriff
Posts: 4274
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!