my dog learned polymorphism*
The moose likes Beginning Java and the fly likes error: cannot resolve symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error: cannot resolve symbol" Watch "error: cannot resolve symbol" New topic
Author

error: cannot resolve symbol

Joseph Carr
Greenhorn

Joined: Dec 11, 2003
Posts: 7
I am fairly new to the java platform. I have just installed it and done everything that i know to do. As far as i know everything is right. I was putting in a program from the new HEAD FIRST java book, which is exceptionally well written might i add, however when i put in the code my computer isnt recognizing the dot operator and some other interesting parts of what i would call a pretty simple program. Please help, i want to make sure i am doing everything right. To give you a good idea what is going on: I have installed j2sdk1.4.2_03 and changed my path name and i have even written a simple hello world program. So i knnow that everything is working ok. I am thinking i am missing a plug in or have a file in the wrong direstory, but i still don't really know. Please help!!

everywhere <<<< is where the error is given to me.
public class GuessGame {
Player p1;
Player p2;
Player p3;
public void startgame() {
p1 = new Player();
p2 = new Player();
p3 = new Player();
int guess1 = 0;
int guess2 = 0;
int guess3 = 0;
boolean p1isRight = false;
boolean p2isRight = false;
boolean p3isRight = false;
int targetNumber = (int) (Math.random() * 10);
System.out.println("I'm thinking of a number between 0 and 9...");
while(true) {
System.out.println("Number to guess is " + targetNumber);
p1.guess();
p2.guess();
p3.guess();
guessp1 = p1.number;
System.out.println("Player one guessed " + guessp1); <<<<<
guessp2 = p2.number;
System.out.println("Player two guessed " + guessp2); <<<<<
guessp3 = p3.number;
System.out.println("Player three guessed " + guessp3); <<<<<

if (guessp1 == targetNumber) { <<<<<
p1isRight = true;
}
if (guessp2 == targetNumber) { <<<<<
p2isRight = true;
}
if (guessp3 == targetNumber) { <<<<<
p3isRight = true;
}
if (p1isRight || p2isRight || p3isRight) {
System.out.println("We have a winner!");
System.out.println("Player one got it right?" + p1isRight);
System.out.println("Player two got it right?" + p2isRight);
System.out.println("Player three got it right?" + p3isRight);
System.out.println("Game is over");
break;
} else {

System.out.println("Players will have to try again.");
}
}
}
}


there are others but ive forgotten how to look page by page in dos...oopsie.
[ December 11, 2003: Message edited by: Joseph Carr ]
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817


Unless I'm mistaken, you want your variable guessp1 to be guess1 as you defined earlier in the file, no? Same with the other two files.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joseph Carr
Greenhorn

Joined: Dec 11, 2003
Posts: 7
Thank you. everything is good with that class. But i still have problems with the dot operator, in a another portion of the program, in this class below:
public class GameLauncher {
public static void main (String[] args) {
GuessGame game = new GuessGame();
game.startGame(); <<<<< here it doesnt like the dot
}
}

is there more i can do???
Manoj Zachariah
Ranch Hand

Joined: Dec 08, 2003
Posts: 65
it should be
game.startgame();
as your function is written fully in lowercase..
Joseph Carr
Greenhorn

Joined: Dec 11, 2003
Posts: 7
is their a prize for the dumbest question?

though i will have to say i copied it directly from the Head First book...
and i checked it has a capital "G"...
[ December 12, 2003: Message edited by: Joseph Carr ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error: cannot resolve symbol
 
Similar Threads
GuessGame Errors From Head First Java
GuessGame errors
Head First Java Book, Chapter 2
Please Help with Guessing Game (Head First Java)
Very new to java