Quantcast
Channel: BlogoSfera » numeric
Viewing all articles
Browse latest Browse all 12

How can I validate a numeric input in java?

$
0
0

I’ve validated that the entered string is a number. while (true) { try { numberOfmiles = Double.parseDouble(JOptionPane.showInputDialog(null," Enter Positive Number")); break; } catch (NumberFormatException nfs) { JOptionPane.showMessageDialog(null, "Please Enter a Positive number"); } } I need to also check that it is a positive number. How would I do that?

The post How can I validate a numeric input in java? appeared first on BlogoSfera.


Viewing all articles
Browse latest Browse all 12

Trending Articles