Java Reference
In-Depth Information
Are the calls to the endOfMonth methods resolved by early binding or
late binding? Inside the printBalance method, is the call to
getBalance resolved by early binding or late binding?
΢ Exercise R10.13. Explain the terms shallow copy and deep copy.
΢ Exercise R10.14. What access attribute should instance fields have? What
access attribute should static fields have? How about static final fields?
΢ Exercise R10.15. What access attribute should instance methods have?
Does the same hold for static methods?
΢΢Exercise R10.16. The fields System.in and System.out are static
public fields. Is it possible to overwrite them? If so, how?
΢΢Exercise R10.17. Why are public fields dangerous? Are public static fields
more dangerous than public instance fields?
΢GExercise R10.18. What is the difference between a label, a text field, and a
text area?
΢΢GExercise R10.19. Name a method that is defined in JTextArea , a
method that JTextArea inherits from JTextComponent , and a
method that JTextArea inherits from JComponent .
Additional review exercises are available in WileyPLUS.
492
493
PROGRAMMING EXERCISES
΢ Exercise P10.1. Enhance the addInterest method of the
SavingsAccount class to compute the interest on the minimum balance
since the last call to addInterest . Hint: You need to modify the
withdraw method as well, and you need to add an instance field to
remember the minimum balance.
΢΢Exercise P10.2. Add a TimeDepositAccount class to the bank
account hierarchy. The time deposit account is just like a savings account,
but you promise to leave the money in the account for a particular number
of months, and there is a penalty for early withdrawal. Construct the
Search WWH ::




Custom Search