这是我的代码:我怎么用“双重”价值与JOptionPane.showInputDialog
currentSalary = (double)(JOptionPane.showInputDialog(frame, "Enter your current salary", "Current Salary", JOptionPane.PLAIN_MESSAGE, null, null, "Numbers only!"));
raise = currentSalary * .04;
total = currentSalary + raise;
NumberFormat money = NumberFormat.getCurrencyInstance();
System.out.println("Your raise is " + money.format(total));
目前,我需要currentSalary双重价值,但我不能,因为JOptionPane中仅持有字符串。在仍然使用对话框的情况下,我该如何去做这件事?任何工作答案表示赞赏。谢谢。
Double.parse()。 – nhouser9
解析方法(对象)未定义为类型Double是它给我的东西 – dirtydan
https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#parseDouble(java.lang .String) – nhouser9