Java Reference
In-Depth Information
CLASSES, OBJECTS, AND METHODS INTRODUCED IN THIS
CHAPTER
java.awt.Component
setPreferredSize
java.awt.Dimension
java.lang.Cloneable
java.lang.CloneNotSupportedException
java.lang.Object
clone
toString
javax.swing.JTextArea
append
javax.swing.JTextField
javax.swing.text.JTextComponent
getText
isEditable
setEditable
setText
REVIEW EXERCISES
Exercise R10.1. What is the balance of
b
after the following operations?
SavingsAccount b = new SavingsAccount(10);
b.deposit(5000);
b.withdraw(b.getBalance() / 2);
b.addInterest();
Exercise R10.2. Describe all constructors of the
SavingsAccount
class. List all methods that are inherited from the
BankAccount
class.
List all methods that are added to the
SavingsAccount
class.
Exercise R10.3. Can you convert a superclass reference into a subclass
reference? A subclass reference into a superclass reference? If so, give
examples. If not, explain why not.
489
490
Exercise R10.4. Identify the superclass and the subclass in each of the
following pairs of classes.
a.
Employee, Manager