Features to Note

Here are some other features to note in this class. Notice now the extends keyword is used to indicate that inheritance is taking place. Classes which do not explicitly inherit from another class are, in Java, implicitly assumed to inherit from the root class Object.

Read carefully the constructor function. Notice how the pseudo-variable super is being used to mark the place where the parent constructor should be invoked, as well as the arguments to pass on to the parent function.

Finally, note that in Java, as in many object-oriented languages, the semantics of overriding is replacement. That is, the function in the child class totally replaces the function found in the parent class. The parent class function will then never be invoked.

[audio] [real] Text to accompany slide17, in Chapter 8 of An Introduction to Object-Oriented Programming