Java Reference
In-Depth Information
5. We need a counter that counts the number of withdrawals and deposits.
6. It needs to reduce the balance, and it cannot access the balance field
directly.
7. So that the count can reflect the number of transactions for the following
month.
8. It was content to use the default constructor of the superclass, which sets
the balance to zero.
9. NoȌthis is a requirement only for constructors. For example, the
Checking-Account.deposit method first increments the transaction
count, then calls the superclass method.
10. We want to use the method for all kinds of bank accounts. Had we used a
parameter of type SavingsAccount , we couldn't have called the method
with a CheckingAccount object.
11. We cannot invoke the deposit method on a variable of type Object .
12. The object is an instance of BankAccount or one of its subclasses.
13. The balance of a is unchanged, and the transaction count is incremented
twice.
14. Accidentially forgetting the private modifer.
15. Any methods of classes in the same package.
16. It certainly shouldȌunless, of course, x is null .
17. If toString returns a string that describes all instance fields, you can
simply call toString on the implicit and explicit parameters, and
compare the results. However, comparing the fields is more efficient than
converting them into strings.
18. Three: InvestmentFrameViewer , InvestmentFrame , and
BankAccount .
19. The InvestmentFrame constructor adds the panel to itself.
Search WWH ::




Custom Search