0
gameIssue: someone could tell me why this game isn't working like it should?
public class Game { public static void main(String[] args) { Scanner input = new Scanner(System.in); String secretWord = "bagel"; String attempt = ""; int numAttemtps = 0; int limAttemtps = 3; while (numAttemtps < limAttemtps && attempt != secretWord) { System.out.print("guess the secret word: "); attempt = input.nextLine(); ++numAttemtps; } if (attempt == secretWord){ System.out.println("you won!!!"); } else if (numAttemtps == limAttemtps){ System.out.println("you lost!!"); } } }
1 Antwort
+ 1
What type of bug are you getting?