Please explain what i missed
The problem suddenly happening when i type a not integer symbol, with intention to get InputMismatchException , a next step i waiting is a invitation to the next attempt to type something. But i get a endless cycle instead. ArithmeticException - works as intended. If i'll type 0, i'll got the message "Something but not zero" and then another chance to type something public class TryCatchE { public static void main (String[] args){ int g = 0; boolean flag=true; Scanner prospect = new Scanner(System.in); System.out.println("Type something "); while (flag) { flag=false; try { int in = prospect.nextInt(); g /= in; } catch (InputMismatchException e) { flag = true; System.out.println ("Something Integer"); } catch (ArithmeticException e) { flag=true; System.out.println("Something but not zero"); } } } }