title: try catch exception while loop
body: <p>I would like the program to re-do the while loop when it catches the exception - the exception being receiving a number zero. Instead it continues a while loop with the code below, I would like it to ask for the user input again until the user inputs a number that is different by zero.</p>
  
  <pre><code>import java.util.InputMismatchException;
  import java.util.Scanner;
  
  public class whilePerjashtim {
  
      public static int division(int a, int b){
  
          return a/b;
      }
  
      public static void main(String[] args) {
  
          Scanner s = new Scanner(System.in);
          int a, b;
  
          System.out.println("Enter a value: ");
          a = s.nextInt();
  
      while(true){
  
          try
          {
  
              System.out.println("Enter b value");
              b = s.nextInt();
  
              System.out.println("Sum of division is: " + division(a,b));
  
  
          }
  
          catch(ArithmeticException e) 
          {
              System.err.println("Don't divide by zero!!!");      
          }
  
          catch (java.util.InputMismatchException e)
          {
              System.err.println("Enter just a Number!!!");
          }
  
          finally
          {
              System.out.println();
          }
  
      }
  
      }
  }
  </code></pre>