Better site compare to remaining for java -


how go same statement in java.(if exception arise want execute :: system.out.println("enter initial balance"); statement.

try{                 system.out.println("enter initial balance");     bal=scan.nextdouble();      }    catch(exception e){     system.out.println("enter numbers" );  }   

one possible solution put in while loop , use boolean check exception:

boolean exception;  {     exception = false;     try {         system.out.println("enter initial balance");         bal = scan.nextdouble();     } catch (exception e) {         exception = true;         scan.next(); //discard input     } } while (exception); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -