while(!ok){ System.out.println("enter a number"); String s=reader.readLine(); ok=true; try{ double d=Double.parseDouble(s); } catch (NumberFormatException e){ System.out.println("That is not a number!"); ok=false; } } //
while(!ok){ System.out.println("enter a number"); String s=reader.readLine(); ok=true; try{ double d=Double.parseDouble(s); } catch (NumberFormatException e){ System.out.println("That is not a number!"); ok=false; } } //