title: My toString() method isn't overriding the Calendar toString() method
body: <p>Here is my code, pretty simple really. Its not homework, I'm teaching myself java through an education book:</p>
  
  <hr>
  
  <pre><code>import java.util.*;
  
  /** @author Chris */
  
  public class Exercise9_9 extends GregorianCalendar
  {   
      public static void main(String[] args)
      {
          String[] stringList = {"s", "c", "b", "f", "e", "q", "g", "w", "i", "o"};
          Integer[] integerList = {5, 7, 8, 9, 6, 5, 4, 1, 2, 3};
          Calendar[] calendarList = new Calendar[10];
  
          for (int a = 0; a &lt; calendarList.length; a++)
          {
              calendarList[a] = new GregorianCalendar();
              calendarList[a].set(Calendar.YEAR, ((int)Math.random()* 1000));
          }
  
          System.out.println("Largest String: " + max(stringList));
          System.out.println("Largest int: " + max(integerList));
          **System.out.println("Largeset date: " + (max(calendarList)).toString());**
      }
  
      public static Object max(Object[] a)
      {
          Arrays.sort(a);
          return a[a.length-1];
      }
  
      **@Override
      public String toString()**
      {
          return "Test";
      }  
  }
  </code></pre>
  
  <hr>
  
  <p>The question is to produce three arrays: int, String and Calendar type. Then pick out the biggest out of each category (and display the answers). </p>
  
  <p>This class extends the <code>GregorianCalendar</code> class which means I have access to the Calendars <code>toString()</code> which I'm trying to override. However it doesn't work. Its like the <code>toString()</code> method isn't overriding because I'm getting the default <code>toString()</code> output. However, I'm using Netbeans and it acknowledges the override and even takes me to to <code>Calendar.toString()</code> when I click the override link. So I'm stuck, any help would be appreciated.</p>