i. Emphasize class structure, comments (grading)
1. 15% OOP, 10% Commenting we dont provide
shell
ii. Partners - by Friday
i. Sample questions
ii. Last springs exam
i. Extends clause
ii. public class <className> extends
<className>
iii. Extend either Exception or Runtime Exception,
depending on whether you want it to be checked or unchecked.
i. Inheritance relationship between classes
ii. Subclasses/children and Superclasses/parents
iii. The role that extends plays in this
defining a subclass
1. Question why do we define the inheritance
relationship in the child instead of the parent?
2. Answer what if you add your own child class
would you want to have to change the parent too?
i. If your code calls for a superclass, you can
use one of its subclasses.
1. Vehicle/car
ii. More specific classes can still use methods
from their parent classes
1. Vehicle/car
i. Overriding methods
1. Vocabulary overloading vs overriding
2. Overriding
a. We override the default getMessage method in
exception classes
b. Another example printStackTrace()
3. Overloading
a. Overloading constructors
b. Overloading methods
i. Use for accessing methods from super class
that are overridden
1. super.method();
ii. Superclass constructors
1. super(params);
i. Remember a class can only extend one other
class.
ii. But, if class C extends class B, class B
either extends another class, or Object, and so forth
1. Direct vs indirect superclass
iii. Cyclic class inheritance error if we try to
make an inheritance cycle
iv. Thus, Object is a superclass for every class
top of the tree, so to speak