title: Java increment an integer within a loop
body: <p>My assignment is to read text files that contain combinations for a family with possible outcome of children. <code>GG = two girls</code>, <code>GB</code> and <code>BG = one boy one girl</code>, <code>BB = two boys</code>. I am supposed to find the sample's size, and then print ratios of each of the 3 possible outcomes.
  I can't seem to get my variables to increment throughout the loop, they come up as 0 every time. I checked the debugger and it shows that each file is being read correctly but the increments aren't working for some reason.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.File;
  import java.io.IOException;
  public class Family
  {
     public static void main(String[] args) throws IOException
  {
    String token = "";
    int girlGirl = 0;
    int boyBoy = 0;
    int girlBoy = 0;
    int sampleSize = 0;
    File fileName = new File("test2.txt");
    Scanner inFile = new Scanner(fileName);
  
    //read file and get data
    while (inFile.hasNext())
    {
       token = inFile.next();
       if(token == "GG")
       {
           girlGirl++;
           sampleSize++;
       }
       else if(token == "BB")
       {
           boyBoy++;
           sampleSize++;
       }
       else if(token == "GB")
       {
           girlBoy++;
           sampleSize++;
       }
       else if(token == "BG")
       {
           girlBoy++;
           sampleSize++;
       }
    }
    inFile.close();
  
    int percentBoyBoy = (boyBoy / sampleSize) * 100;
    int percentGirlGirl = (girlGirl / sampleSize) * 100;
    int percentGirlBoy = (girlBoy / sampleSize) * 100;
    //print results of sample
    System.out.println("Sample Size: " + sampleSize);
    System.out.println("Two Boys: " + percentBoyBoy  + "%");
    System.out.println("One Boy One Girl: " + percentGirlBoy  + "%");
    System.out.println("Two Girls: " + percentGirlGirl  + "%");
  }//end of main method
  }//end of class 
  </code></pre>