How would I make a condition in this code
Here's the code of my program..
Code:
double sam ;
try{
sam = Double.parseDouble(
this.insam.getText());
} catch(Exception e){
JOptionPane.showMessageDialog(this, "Re-enter Sample Size of Col A",
"Invalid Input", JOptionPane.ERROR_MESSAGE);
return;
}
Now, I want to make an exception that is if "sam" is less than 30, an Error Message will come out... But more than 30 the value is accepted. I tried some condition, but It doesn't work... Please check it below
Code:
if (sam > 30){
sam = Double.parseDouble(this.insam.getText());
}else{
JOptionPane.showMessageDialog(this, "Re-enter Sample Size of Col A", "Invalid Input",
JOptionPane.ERROR_MESSAGE);
return;
}
thanks for your help...