Java returns error that variable not initialized when it is
<p>I have the following Java code:</p>

<pre><code>import java.util.Scanner;

public class C2F_F2C {


public static void main(String[] args) {
    boolean isNotValid = false;
    double toConvert;
    do {
        System.out.print("What do you want to convert from Celsius to Fahrenheit? ");
        Scanner in = new Scanner(System.in);
        String toConvertString = in.nextLine();
        isNotValid = false;
        try {
            toConvert = Double.parseDouble(toConvertString);
        }
        catch (java.lang.NumberFormatException e) {
            System.out.println("Error: Not a number");
            isNotValid = true;

        }
    } while (isNotValid);

    double inCelsius = toCelsius(toConvert);
    System.out.println("The value " + toConvert + " in Celsius is " + inCelsius);


}
public static double toCelsius( double fahrenheit ) {

    double celsius = (fahrenheit -32)*(5/9);
    return celsius;


}


}
</code></pre>

<p>However, when I run it, it throws the following error:</p>

<pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    The local variable toConvert may not have been initialized
    The local variable toConvert may not have been initialized

    at C2F_F2C.main(C2F_F2C.java:24)
</code></pre>

<p>I initialized the variable before the do..while loop, and set the value in the try..catch loop. It appears that the variable has not been set. Sorry if this is a rather basic question, but I can't seem to figure it out.</p>
