title: Scanner Class ~ hasNextDouble();
body: <pre><code>package pkgswitch;
  import java.util.Scanner;
  public class Switch {
      public static void main(String[] args) {
          double subtotal = 0.0;
          Scanner sc = new Scanner(System.in);
          outerloop:
          while(0==0){
              System.out.print(&quot;Enter subtotal:   &quot;);
              if (sc.hasNextDouble())
              {
                  subtotal=sc.nextDouble();
              }
              else
              {
                  sc.nextLine();
                  System.out.println(&quot;Error!&quot;);
                  continue outerloop;
              }
          }       
      }
  }
  </code></pre>
  <p>I'm working with learning how to catch exceptions. (I know about the <code>try</code> / <code>catch</code>)</p>
  <h3>Question:</h3>
  <p>How does scanner have more double tokens when it has just been initialized with no input</p>