title: This code throws an exception for the line Integer.parseInt(data[2])
body: <p>In my <code>playerList.txt</code> I have lines constructed as such: </p>
  
  <pre><code>Nathaniel, Clyne, 12, first
  </code></pre>
  
  <p>Why can't it accept <code>Integer.parseInt</code>?</p>
  
  <p>I have a class <code>MemberPlayer</code> that defines a <code>MemberPlayer</code> should have the first name, last name, age and team (first or second).</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NumberFormatException: For input 
    string: " 12"<br>
    at java.base/java.lang.NumberFormatException.forInputString NumberFormatException.java:65)<br>
    at java.base/java.lang.Integer.parseInt(Integer.java:638)<br>
    at java.base/java.lang.Integer.parseInt(Integer.java:770)<br>
    at FileHandler.getContent(FileHandler.java:53)<br>
    at Main.main(Main.java:55)</p>
  </blockquote>
  
  <pre><code>   public static final String FINAL_PATH = "playerList.txt";
  
     public static ArrayList&lt;MemberPlayer&gt; getContent(String FINAL_PATH)
       {
          ArrayList&lt;MemberPlayer&gt; list = new ArrayList&lt;MemberPlayer&gt;();
          try
          {
                Scanner sc = new Scanner(new File(FINAL_PATH));
                while(sc.hasNextLine())
                {                                   
                      String data[] = sc.nextLine().split(",");
                      list.add(new MemberPlayer(data[0], data[1], 
                      Integer.parseInt(data[2]), data[3]));
                }
  
          }
          catch(FileNotFoundException e)
          {
  
          }
          return list;
     }
  </code></pre>