04-24-2011, 09:41 PM
sir
my question about if user enter wrong input like enter text instead of number then out catch block will be executes and message appear what we type but sir i want to know how can i again get input or show the message again until user enter correct entry, like
String total=JOptionPane.showInputDialog("Enter total number");
try{
float i=Float.ParseFloat(total);//if exception catch block executes
}
catch(NumberFormatException nfe{
JOptionPane.showMessageDialoge("enter correct format");
}
my question about if user enter wrong input like enter text instead of number then out catch block will be executes and message appear what we type but sir i want to know how can i again get input or show the message again until user enter correct entry, like
String total=JOptionPane.showInputDialog("Enter total number");
try{
float i=Float.ParseFloat(total);//if exception catch block executes
}
catch(NumberFormatException nfe{
JOptionPane.showMessageDialoge("enter correct format");
}

mileys81: