Waleed Waleed - 1 year ago 184
Java Question

nextDouble error symbol: method nextDouble

symbol: method nextDouble

nextDouble "error"

Can any one help me to fix that ?

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);

Answer Source

You'e confusing String with java.util.Scanner. Parse the string returned from showInputDialog

fahrenheit = Double.parseDouble(input);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download