title: Why is creating an instance of this object altering the instance variable of another object?
body: <p>I have defined a bankaccount class, and created two different accounts that extend bankaccount: savings account and checkings account. Their constructors I have posted below:</p>
  
  <pre><code>public class TimeDepositAccount extends SavingsAccount{
      private int numberOfMonths;
      private static final double WITHDRAW_PENALTY = 20;
  
      TimeDepositAccount(double interestRate, int numberOfMonths){
          super(interestRate);
          this.numberOfMonths = numberOfMonths;
      }
  }
  </code></pre>
  
  <p>and savings account: </p>
  
  <pre><code>public class SavingsAccount extends BankAccount {
      private static double interestRate;
  
      public SavingsAccount(double interestRate){
          super();
          this.interestRate = interestRate;
      }
  
  
  }
  </code></pre>
  
  <p>In my tester I create a savingsaccount, and then a timedeposit account: </p>
  
  <pre><code>SavingsAccount momsSavings = new SavingsAccount(5);
  TimeDepositAccount collegeFund = new TimeDepositAccount(10, 3);
  </code></pre>
  
  <p>After going through the debugger, momsSavings' interest rate is set to 5 like i specified, however, when i create collegeFund, the program changes momsSavings' interest rate to 10, along with creating the collegeFund object. Could someone tell me where my error is?</p>
  
  <p>Thank you.  </p>