title: How to resolve Java util input mismatch Error
body: <p>Hello I am learning Java so I am getting the following error an I do not understand why I am getting the error because I when I change the datatype to Int and then run the code, the code runs properly without any errors so I get a bit confused on what is really happening</p>
  <p><strong>Error Message</strong></p>
  <p>Exception in thread &quot;main&quot; java.util.InputMismatchException</p>
  <pre><code>at java.base/java.util.Scanner.throwFor(Scanner.java:939)
  at java.base/java.util.Scanner.next(Scanner.java:1594)
  at java.base/java.util.Scanner.nextFloat(Scanner.java:2496)
  at SecondProject/com.SecondProject.Fundamentals.workerPay(Fundamentals.java:22)
  at SecondProject/com.SecondProject.Fundamentals.main(Fundamentals.java:8)
  </code></pre>
  <p><strong>Code below</strong></p>
  <pre><code>package com.SecondProject;
  
  import java.util.*;
  
  public class Fundamentals {
  
      public static void main(String[] args) {
          workerPay();
      
  
      }
      public static void workerPay() {
      
          float hours;
          float rates;
          float total_pay;
          float extra_hours;
          float tax;
      
          Scanner sc = new Scanner(System.in);
          System.out.println(&quot;Enter in your hours of work: &quot;);
          hours = sc.nextFloat();
      
          System.out.println(hours);
      
      
      }
  
  }
  </code></pre>