title: I am getting a numberformatexception
body: <p>I am trying to search a file, a small one, for a string that I input and then output only the double values on that line. I am getting an error each time I try something. Also I am trying to avoid using loops so its a little challenging(I know there is a while loop but I will deal with that next.. Any help would be appreciated. Oh yeah and the text file looks like this(those two top stock tickers).</p>
  
  <pre><code>AAPL 101.50
  MSFT 45.84
  
  
  File file = new File("stocks.txt");
          Scanner ticker = new Scanner(System.in);
          Scanner scan = new Scanner(file);
                  String phone;
                  System.out.print("\nEnter a stock ticker: ");
                  String that = ticker.next();
  
  
  
                  while(scan.hasNext())
                {      
                    phone = scan.nextLine();
                    //double b = Double.parseDouble(phone);
                   if(phone.contains(that))
                   System.out.println(phone + "\n");
  
                }     
  
  
  
  
  one of the errors is:
  
  Enter a stock ticker: AAPL
  Exception in thread "main" java.util.InputMismatchException
      at java.util.Scanner.throwFor(Scanner.java:864)
      at java.util.Scanner.next(Scanner.java:1485)
      at java.util.Scanner.nextDouble(Scanner.java:2413)
      at hw01a.java.Hw01aJava.main(Hw01aJava.java:36)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 4 seconds)
  
  the other is:
  
  Enter a stock ticker: AAPL
  Exception in thread "main" java.lang.NumberFormatException: For input string: "AAPL 101.50"
      at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
      at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
      at java.lang.Double.parseDouble(Double.java:538)
      at hw01a.java.Hw01aJava.main(Hw01aJava.java:34)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 4 seconds)
  </code></pre>