title: Java program that will tell if user input is a double or not
body: <p>I need some code that will tell whether or not some user input is a <code>double</code>. If it is a <code>double</code>, I need it stored in the variable <code>degreeCelsius</code> and if it isn't, I need the program to exit. Overall, the program is going to take some <code>double</code> values and use them as degrees Celsius and convert them to degrees Fahrenheit. This is what I have so far: </p>
  
  <pre><code>import java.util.*;
  public class Lab4b
  {
      public static void main(String[] args)
      {
          Scanner scan = new Scanner(System.in);
          double degreeCelsius = 0.0;
          double degreeFahrenheit = 0.0;
          System.out.println("Celcius    | Fahrenheit");
  
          while(scan.next() != null)
              {    
  //this is where I need the code. If you see any other errors, feel free to correct me
              //if (degreeCelsius = Double)
                      {
                          degreeCelsius = scan.nextDouble();
                      }
                  else
                      {
                          System.exit(0);
                      }
                  degreeFahrenheit = degreeCelsius * (9.0/5.0) + 32.0;
              }
      }
  }
  </code></pre>