Java nextDouble错误符号:方法nextDouble

Java nextDouble错误符号:方法nextDouble,java,double,next,Java,Double,Next,符号:方法nextDouble 下一个双重“错误” 有人能帮我修一下吗 double fahrenheit; String input = JOptionPane.showInputDialog(null, "Enter the Fahrenheit degre : "); fahrenheit = input.nextDouble(); double Celsius = 5/9 * (fahrenheit-32); JOptionPane.sho

符号:方法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);

你把
String
java.util.Scanner
搞混了。分析从
showInputDialog

fahrenheit = Double.parseDouble(input);

顺便说一句,您有一个整数除法问题-使用
double-centrics=5/9.0*(华氏32度)