title: Java Scanner keep asking for input until variable is a double or int, or empty, at which point is given default value
body: <p>here is the pseudo for what im asking</p>
  
  <pre><code>1. Take value
  2. is value double or int?
  3. if so, continue in program
  4. else
  5. is value empty?
  6. if value empty; value=0.08
  7. else
  8. at this stage, value is not an empty valid, or a valid double or valid int
  9. user did it wrong, prompt error
  10. jump to step one take value
  </code></pre>
  
  <p>So to me this is pretty complicated, im new to this.</p>
  
  <p>Ive been trying to impliment it like so;</p>
  
  <pre><code>while ( costscan.hasNext() )
    {
      double costperkm = costscan.nextDouble();
      if (costperkm=double){
        System.out.println("Value is double");
        System.out.println("FUEL COST SAVED ");
      }
      else {
              if(costperkm=null){
                 costperkm=0.08;
            }
              else{
  
                  }
      System.out.println("FUEL COST SAVED ");
           }
      System.out.print("\n");
      System.out.print("\n");
    }
  </code></pre>
  
  <p>My code above is the result of just playing about so at this stage it may not even make sense anymore. Hope someone can help, thanks.</p>