Files
  • Main.java
  • Main.class
  • Student.class
  • Student.java
  • StudentAthlete.class
  • StudentAthlete.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class Main
{
   //-----------------------------------------------------------------
   //  Creates objects of two student types, prints some information
   //  about them, then checks them for equality.
   //-----------------------------------------------------------------
   public static void main (String[] args)
   {
      Student Frank = new Student ("Frank", 5);
      StudentAthlete Suki = new StudentAthlete ("Suki", 4, "Soccer");
      Student Giovanni = new StudentAthlete ("Giovanni", 9, "Baseball");
      System.out.println (Frank);
      System.out.println ();
      System.out.println (Suki);
      System.out.println ();
      System.out.println (Giovanni);
      System.out.println ();
      if (! Frank.equals(Suki))
         System.out.println ("These are two different students.");
   }
}