Java的問題,我相信這是一個快速解決:如果其他語句做了它應該做的反應! Java的
public void setFlappyBirdHighScore(int newFlappyBirdHighScore) {
if(newFlappyBirdHighScore > 999 || newFlappyBirdHighScore != 999)
{
if(newFlappyBirdHighScore == flappyBirdHighScore) {
System.out.println("The new score is the same as the old high score, please enter yor new high score");
}
else {
flappyBirdHighScore = newFlappyBirdHighScore;
System.out.println("Your new FlappyBird High Score is: " +newFlappyBirdHighScore);
}
}
else {
System.out.println("You have to many digits in your score, please use 1-3 digits.");
}
}
現在它打印最終else語句時,有小於或999,但我想它說的相反。如果輸入的數字在999以上,我希望它打印最後一條語句,其他兩條工作正常。除了這個小問題,還有什麼快速解決方案?
它做的你期望它做相反的,但它肯定做什麼它應該做的。不要這樣說你的問題。 –
大聲讀出第一個「if」條件,然後想想它是否有意義...... –
您是否打算將第一個if中的'newFlappyBirdHighScore'變量之一作爲'flappyBirdHighScore'?它沒有多少意義。 – lurker