nextDouble错误符号:方法nextDouble

时间:2016-10-20 20:37:14

标签: java double next

symbol:method 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);

1 个答案:

答案 0 :(得分:2)

您将Stringjava.util.Scanner混为一谈。解析从showInputDialog

返回的字符串
fahrenheit = Double.parseDouble(input);