title: Exception in thread "main", What does this mean?
body: <p>I'm working on a homework problem for class. Where you have to calculate the distance between two points. The code is basically done, but I have one question. When I enter q to end the loop. I get a message back.</p>
  
  <p>Exception in thread "main" java.lang.NumberFormatException: For input string: "q"</p>
  
  <p>at.sun.misc.FloatingDecimal.readJavaFormatString(Unkown Source)</p>
  
  <p>at java.lang.Double.parseDouble(Unkown Source)</p>
  
  <p>atDistance.main(Distance.java:11)</p>
  
  <pre><code>import java.util.Scanner;
  public class Distance {
  public static void main(String[] args){
      Scanner input = new Scanner(System.in);
      while (true){
          System.out.print("Enter coordinate for x1: ");
          String x1String = input.next();
          if (x1String == "q")
              break;
              double x1 = Double.parseDouble(x1String);
  
          System.out.print("Enter coordinate for y1: ");
          String y1String = input.next();
          if (y1String == "q")
              break;
              double y1 = Double.parseDouble(y1String);
  
          System.out.print("Enter coordinate for x2: ");
          String x2String = input.next();
          if (x2String == "q")
              break;
              double x2 = Double.parseDouble(x2String);
  
          System.out.print("Enter coordinate for y2: ");
          String y2String = input.next();
          if (y2String == "q")
              break;
              double y2 = Double.parseDouble(y2String);
  
          double distance = (Math.pow(x2 - x1,2)) + (Math.pow(y2 - y1,2));
          distance = Math.sqrt(distance);
          System.out.printf("The distance is %5.2f",distance);
          System.out.println("");
      }
  }//main
  }//Distance
  </code></pre>
  
  <p>That is the code I have written. Any help is appreciated.</p>