I am trying to use a number (1/2/3) the user inputs to control something. When I try to use converted choice it says cannot find symbol. Why is this?
// Start user input //
public static int userChoice() {
Scanner userInput = new Scanner(System.in);
String choice = userInput.nextLine();
int convertedChoice = Integer.parseInt(choice);
return convertedChoice;
}
// End user input //
// Start scan maze //
static void whatMaze() {
if (convertedChoice == 1) {
System.out.println("you chose 1");
} else {
System.out.println("you chose something else");
}
}