double parse jtextfield
public static void main(String[] args) {
double amount=0.0;
try {
amount = Double.parseDouble(txtMonth.getText());
} catch (Exception e) {
System.err.println("ups, this was not castable to double");
amount=-10.0;
}
System.out.println("Here is the double: "+ amount);
}
3.83
6
Double Amount = Double.valueOf(txtMonth.getText());
Thank you!
6
0
4.2
5
double Amount = Double.parseDouble(txtMonth.getText());
Thank you!
5
0
Are there any code examples left?
New code examples in category Java