How can I solve it ???
Why the second catch keeps printing in the output console ...
I just mean to print it once and then get back to the loop again if the boolean data type is not true .
Scanner input=new Scanner(System.in);
int a ,b,result;
boolean status=false;
while(!status){
try{
a=input.nextInt();
b=input.nextInt();
result=a/b;
status=true;
}catch (ArithmeticException ex){
System.out.println(ex.getMessage());
}catch(InputMismatchException ex){
System.out.println(ex);
}catch(Exception ex){
System.out.println(ex.getMessage());
}
}
}