title: Format Exception reading a File in Java
body: <p>I'm trying to read a file that has many lines with patient's info like this:</p>
  
  <pre><code>72514202,John,Schwimmer,h,60,65,166,68,126,69,n,68
  </code></pre>
  
  <p>I have set up the following code in the main method: </p>
  
  <pre><code>    Scanner inFile = new Scanner(new File("File001.txt"));
  
      while (inFile.hasNext())
      {
          String line = inFile.nextLine();
          String[] temp = line.split(",");
  
          int doc = Integer.valueOf(temp[0]); //id 
          String name = temp[1]; //name
          //other data set,
      }
  </code></pre>
  
  <p>My problem is, I have checked that the file is in the same folder as the java program and that it is properly named, yet I'm getting this exception for what would be temp[0], the first person's ID</p>
  
  <pre><code>java.lang.NumberFormatException: For input string: ""
  at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
  at java.base/java.lang.Integer.parseInt(Integer.java:662)
  at java.base/java.lang.Integer.valueOf(Integer.java:983)
  at Principal.main(Principal.java:49)
  </code></pre>
  
  <p>why could I be getting this exception? why is it not reading the file properly?</p>