Why I'm having an infinite loop when I enter a non-digit token?
public class ExceptionHandling {
static int i;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
boolean b=true;
Scanner in=new Scanner(System.in);
while (b ==true) {
try{
i=in.nextInt();
b=false;
// System.out.println("not executrd bcoz above exception");
}
catch(InputMismatchException e){
System.out.println(i);
}
}
}
}