【发布时间】:2016-10-20 20:37:13
【问题描述】:
符号:方法 nextDouble
nextDouble“错误”
谁能帮我解决这个问题?
double fahrenheit;
String input = JOptionPane.showInputDialog(null, "Enter the Fahrenheit degre : ");
fahrenheit = input.nextDouble();
double Celsius = 5/9 * (fahrenheit-32);
JOptionPane.showMessageDialog(null, " in Celsius : " + Celsius);
【问题讨论】:
-
顺便说一句,您遇到了整数除法问题 - 使用
double Celsius = 5/9.0 * (fahrenheit-32);