title: Finding every other integer token using a Scanner for the file
body: <p>I'm using a <code>Scanner</code> for a file example that's got 4 boys and 3 girls. After each name there is an integer (for instance <code>Mike 24</code>) and it starts with a boy then girl then boy then girl etc. In total there are 4 boys and 3 girls and I'm supposed to count the number of boys and girls and then add up each boys numbers for the sum then the same for girls. Also, when I assigned boys the <code>console.nextInt()</code> does that take the number from the file and then assign to the boys variable? Also, does <code>console.hasNext()</code> have an index like if it reads token #1 then I can say <code>console.hasNext() == 1;</code>?</p>
  <p>Sample data:</p>
  <pre><code>Erik 3 Rita 7 Tanner 14 Jillyn 13 Curtis 4 Stefanie 12 Ben 6
  </code></pre>
  <p>Code:</p>
  <pre><code>import java.util.*;
  import java.io.*;
  public class Lecture07 {
  
    public static void main(String[] args)  throws FileNotFoundException{
      System.out.println();
      System.out.println(&quot;Hello, world!&quot;);
     
      // EXERCISES:
  
      // Put your answer for #1 here:
      // You will need to add the method in above main(), but then call it here
      Scanner console = new Scanner(new File(&quot;mydata.txt&quot;));
      boyGirl(console);
    }
  
  
    public static void boyGirl(Scanner console) { 
      int boysCount = 0;
      int girlsCount = 0;
  
      while (console.hasNext()) {
            if (console.hasNextInt()) {
                int boys = console.nextInt();
                int girls = console.nextInt();
                    
            }
            else {
              console.next();
            }
      }
  
    } 
  }
  </code></pre>