Hi,
I try to write piece of code that get input from the user and in case of wrong input give the user anoter chance (total of 3 tries) to type input again.
what is the problem with it?
this is the piece of code:
while (tries < 5) { try{ System.out.println("Enter height: "); inp = Double.parseDouble(b.readLine()); crr=1; if(crr>=1) break; } catch (Exception e){ System.out.println("wrong input, try again"); continue; } finally { tries ++; } } if (tries == 3) throw new Exception(); catch (Exception e) System.out.println("exiting program");