previous | start | next

Self Check

  1. If a refers to a bank account, then the call a.deposit(100) modifies the bank account object. Is that a side effect?
  2. Consider the DataSet class of Chapter 7. Suppose we add a method
    void read(Scanner in)
    {
    while (in.hasNextDouble())
    add(in.nextDouble());
    }
    Does this method have a side effect?

previous | start | next