title: Boolean Value Not Being Changed in If Statement
body: <p>I have two classes: GameScreen.java and KeyButton.java. There are three buttons that are boolean values (of whether or not they are pressed) referenced in the GameScreen class that I want to compare to values in the KeyButton class. Here is the relevant code:</p>
  
  <p>GameScreen.java:</p>
  
  <pre><code>private void checkButtons() {
  // Log.d("GameScreen","Note and Bar Intersected");
  
  KeyButton keybutton = new KeyButton();
  
    if (B1Pressed == keybutton.getB1() &amp;&amp; B2Pressed == keybutton.getB2() &amp;&amp; B3Pressed == keybutton.getB3()) {
       // Log.i("GameScreenTest", "Correct");
        score++;
    } else {
       // Log.i("GameScreenTest - Result", "Wrong");
       // Log.i("GameScreenTest - Button Pressed", Boolean.toString(B1Pressed));
       // Log.i("GameScreenTest - Button Required", Boolean.toString(keybutton.getB1()));
    }
  }
  </code></pre>
  
  <p>KeyButton.java:</p>
  
  <pre><code>public class KeyButton {
  
  public boolean B1 = false;
  public boolean B2 = false;
  public boolean B3 = false;
  
  Rectangles Rectangles = new Rectangles();
  {
  
      //C major
      if (ScalesScreen.scaleType.equals("C")) {
      //C
      if (GameScreen.intersected == Rectangles.rectangle1) {
              B1 = false;
              B2 = false;
              B3 = false;
          }
      //D
      if (GameScreen.intersected == Rectangles.rectangle2) {
              B1 = true;
              B2 = false;
              B3 = true;
          }
      //E
      if (GameScreen.intersected == Rectangles.rectangle3) {
              B1 = true;
              B2 = true;
              B3 = false;
          }
      //F
      if (GameScreen.intersected == Rectangles.rectangle4) {
              B1 = true;
              B2 = false;
              B3 = false;
          }
  ...
  public boolean getB1() {
      // TODO Auto-generated method stub
      //Log.d("Key 1", Boolean.toString(B1));
      return B1;
  }
  
  public boolean getB2() {
      // TODO Auto-generated method stub
      //Log.d("Key 2", Boolean.toString(B2));
      return B2;
  }
  
  public boolean getB3() {
      // TODO Auto-generated method stub
      //Log.d("Key 3", Boolean.toString(B3));
      return B3;
  }
  </code></pre>
  
  <p>For some reason, the B1, B2, and B3 values are returning false in the GameScreen code (from keybutton.getB1()) causing the score to increase whenever the buttons aren't pressed. So, for some reason, the Boolean values aren't being changed to what they are supposed to be in the KeyButton class. What can I do to fix this?</p>
  
  <p>ADDED:</p>
  
  <pre><code> for (Rect rect : rectangles) {
  
     if(Rect.intersects(rect, bar)) {
       //  Log.d("GameScreen", "intersected");
      intersected = rect;
      //  Log.d("Intersected", intersected.toString());
      checkButtons();
  
    }
  }
  </code></pre>