I have a integer variable but I want it so that if the user inputs the string 'quit' it will close the program.
public static void input() {
System.out.println("Input: ");
Integer choice = scan.nextInt();
choiceExecute(choice);
if (choice == 'quit') {
goBack();
}
}
Thanks in advance.
'quit'isn't a string, that's a 4-charactercharliteral... which is invalid.System.exit(0)goBack()might not be the same asSystem.exit(0)...