title: Java - add value to it to a variable from another class
body: <p>My problem is how do I add a value to a variable from another class, for example:</p>
  
  <pre><code>private int balance;
  </code></pre>
  
  <p>then later in the methods in the same class, I add values to the balance with no problem using: </p>
  
  <pre><code>balance += 50;
  </code></pre>
  
  <p>but when I go to another class, and type the object then the setter for the balance:</p>
  
  <pre><code>myObject.setBalance(50);
  </code></pre>
  
  <p>but the problem strikes here, when I go to the first class and return the balance from there, i get nothing (or the old value of balance) in other words, the NEW value of balance is not being added. Any ideas why? I've been stuck at this point for the last couple of hours</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public class Zoo 
  {
      private int balance;
  
      public void setBalance(int balance)
      {
          this.balance = balance;
      }
  
      public int getBalance()
      {
          return this.balance;
      }
  }
  
  MY SECOND CLASS:
  
  public class RandomEvents
  {
      private Zoo ZooBalance = new Zoo();
  
      public void callEventSix()
      {
          System.out.println("A local group has raised money to your Zoo");
          System.out.println("Would you like to accept the money? (y) or (n)");
          Scanner readerEventThree = new Scanner(System.in);
          String readerTwo = readerEventThree.next();
          if ( readerTwo.equals("y") ) 
          {
              ZooBalance.setBalance(166);
              System.out.println("You have accepted the gift");
              System.out.println("Your new balance is " + ZooBalance.getBalance());
          } else if ( readerTwo.equals("n") )
          {
              System.out.println("You have refused the gift");
          }
      }
  }
  </code></pre>