Waleed Waleed - 1 month ago 5
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

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

fahrenheit = Double.parseDouble(input);
Comments