i am using scanner to take user input.
Scanner scanner = new Scanner(System.in);
Int choice = scanner.nextInt();
if(choice==1) {
System.out.println(" you chosed number 1!")
}
if(choice==2) {
System.out.println(" you chosed number 2!")
}
if(choice==3) {
System.out.println(" you chosed number 3!")
}
if(choice==q) {
System.out.println("the game will end now!");
}
so when you enter the game you have a meny that poops up. you can chose between 1, 2, 3 or q. if you press any of the numbers the game will take you to those sections. but if you press q the game will end.
i dont know how to fix so that i can enter q and game ends. help please
Aucun commentaire:
Enregistrer un commentaire