Source of Child1.java


  1: /**
  2:  * One of a collection of classes that extend Parent. This Child is the 
  3:  * simplest, making no changes to inherited methods.
  4:  *
  5:  *  Child1 has all Parent methods
  6:  *     getValue
  7:  *     setValue
  8:  *  also has own method
  9:  *     sayValue
 10:  *
 11:  * @author Mark Young (A00000000)
 12:  */
 13: public class Child1 extends Parent {

 15:     /**
 16:      * Say this Child's value.
 17:      */
 18:     public void sayValue() { 
 19:         // I have a getValue method!  I inherited it.
 20:         System.out.println("My value is " + this.getValue());
 21:     }

 23: }