我开始了我的第一个Java项目,但陷入了类范围。我无法启动以下代码:
if (guessAttemts = MaxGuesses) {
System.out.println("Sorry you used all your nine chances. Game Over.)
如果有人能帮助我阐明该代码的错误之处,我将不胜感激:此NewGame类如下所示。
class NewGame {
GuessAttempts GuessAttempts = new GuessAttempts();
private String WordToGuess;
private String CorrectGuesses;
private String misses;
int guessAttempts;
int MAX_Guesses = 9;
public NewGame(String WordToGuess) {
this.WordToGuess = WordToGuess;
CorrectGuesses = "";
misses = "";
guessAttempts = 0;
}
public boolean UserGuessing(char letter) {
boolean isHit = WordToGuess.indexOf(letter) != -1;
if (isHit) {
CorrectGuesses += letter;
} else {
misses += letter;
}
guessAttempts =+ 1;
return isHit;
}
if (guessAttemts = MaxGuesses) {
System.out.println("Sorry you used all your nine chances. Game Over.");
}
}
答案 0 :(得分:2)
要与值进行比较,应使用(TaskExecutor: core Pool size - 10, QueueCapacity - 0, and MaxPoolSize - 80)
。
这意味着您的if语句应如下所示:
==