Student.java.html

  1  /**
  2     A student with a name and a major.
  3  */
  4  public class Student extends Person
  5  {
  6     private String major;
  7  
  8     /**
  9        Constructs a Student object.
 10        @param aName the name of the student
 11        @param aMajor the major of the student
 12     */
 13     public Student(String aName, String aMajor)
 14     {
 15        super(aName);
 16        major = aMajor;
 17     }
 18     
 19     public String toString() 
 20     {
 21        return super.toString() + "[major=" + major + "]";
 22     }
 23  }