Example 2-Adding an Attribute to the Hello class

Example 1 introduced a class "Hello" which has a method "sayHello" that prints the fixed string "Hello, World!" Example 2 extends the "Hello" class so that clients can customize the output from the method "sayHello".


[Back: Example 1-Implementing a Simple Class with One Method]
[Next: Attributes vs instance variables]