Lecture 16
13
newMonth Bank.java (203)
•
private void newMonth()
•
{
•
month.next();
•
for (BankAccount acct: accountList) {
acct.newMonth();
•
}
•
}
•
No cast: every subclass of BankAccount must
implement the abstract newMonth method
•
Real code is Java 1.4 (this is Java 1.5)
•
This is easy code to read – use the Java 1.5 as pseudocode. Lines 203ff in Bank.java use Java 1.4 iterator.