int rollnumber;
do {
try {
System.out.println("how many times");
rollnumber = scanner.nextInt();
nigh=2;
if (Integer.toString(rollnumber).equals("q") ) {
System.exit(0);
}
} catch (Exception e){
System.out.println("invalid. re-enter");
scanner.nextLine()';
}
}while (nigh==1);
Basically, I'm trying to make a "q" (quit) option but it just keeps jumping to the catch statement when I press q. Help me make it so that the "scanner.nextInt()" reads the q as the actual quit command.