出现找不到符号
在按照head frist java的例子打得时候出了问题,一直报错找不到符号,自己手打是,重书上复制下来的也是报错下面是代码,各位老哥帮帮忙,谢谢。public class GuessGame
{
Player p1;
Player p2;
Player p3;
public void strtGame()
{
p1 = new Player();
p2 = new Player();
p3 = new Player();
int guessp1 = 0;
int guessp2 = 0;
int guessp3 = 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 guessde is" + guessp1);
guessp2 = p2.number;
System.out.println("Player one guessde is" + guessp2);
guessp3 = p3.number;
System.out.println("Player one guessde is" + guessp3);
if (guessp1 == targetNumber)
{
p1isRight = true;
}
if (guessp2 == targetNumber)
{
p2isRight = true;
}
if (guessp1 == targetNumber)
{
p3isRight = true;
}
if (p1isRight || p2isRight || p3isRIght)
{
System.out.println("We have 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");
break;//游戏结束终止循环
}
else
{
System.out.println("PLayer will have to try again");
}
}
}
}
你有Player这个类吗?没有的话要写一个,有的话要导进来。他不认识这个Player是个啥;看你写的这像是一个“玩家对象”?{:10_254:}
页:
[1]