title: Inapplicable method error regarding interfaces
body: <p>I'm having an issue with one of my methods <em>findLargest(Comparable[ ] arr)</em> in class <em>FindLargest</em> that's meant to return the largest element in an array.</p>
  
  <p>Apparently, in class <em>Lab5Main</em> this method works fine with fractions, but I get a compilation error with dates. In the system print out command, I'm getting this error:</p>
  
  <blockquote>
    <p>The method findLargest(Comparable[ ]) in the type FindLargest is not applicable for the arguments (MyDate[ ])</p>
  </blockquote>
  
  <p>Here is the <strong>supposed program output</strong>:</p>
  
  <pre><code>The largest fraction is 9/4
  The latest date is 18/8/2011
  </code></pre>
  
  <p><strong>My codes are shown below:</strong></p>
  
  <pre><code>public class Lab5Main {
  
    public static void main(String[] args) {
  
      // Fraction
      Fraction fractions[] = new Fraction[3];
      fractions[0] = new Fraction(1, 2);
      fractions[1] = new Fraction(6, 11);
      fractions[2] = new Fraction(9, 4);
      System.out.println("The largest fraction is " + FindLargest.findLargest(fractions));
  
      // MyDate
      MyDate dates[] = new MyDate[3];
      dates[0] = new MyDate(1898, 6, 9);
      dates[1] = new MyDate(2003, 4, 1);
      dates[2] = new MyDate(2011, 8, 18);
      System.out.println("The latest date is " + FindLargest.findLargest(dates));
  
    }
  }
  </code></pre>
  
  <pre><code>public class FindLargest {
      public static &lt;T extends Comparable&lt;? super T&gt;&gt; T findLargest(T[] arr) {
          if (arr.length == 0) {
              return null;
          }
          T max = arr[0];
          for (int i = 0; i &lt; arr.length; i++) {
              if (arr[i].compareTo(max) &gt; 0) {
                  max = arr[i];
              }
          }
          return max;
      }
  </code></pre>
  
  <pre><code>public class Fraction implements Comparable&lt;Fraction&gt; { 
      private int num, denom;
  
  public int gcd(int a, int b)  {  
          if (a%b==0) {
              return b;
          }
          return gcd(b, a%b);  
      } 
  
      public void reduce()  {  
          int g = gcd(num, denom);  
  
          num = num / g;  
          denom = denom / g;  
      }  
  
      public Fraction(int n, int d) {
  
          if (n==0) {
              d=1;
          }
          if (d==0) {
              n=1;
              d=2;
          }
          if(d&lt;0) {
              n=-n;
              d=-d;
          }
  
          num = n;
          denom = d;
  
          reduce();
      }
  
      public String toString() {
          return num + "/" + denom;
      }
  
  @Override
        public int compareTo(Fraction f) {
  //        Fraction f = (Fraction) obj;
            if (Math.abs(value() - f.value()) &lt; 0.00001) {
                return 0;
            }
            if (value() &gt; f.value()) {
                return 1;
            }
            return -1;
        }
        public int compareTo(Object obj) {
            Fraction f = (Fraction) obj;
            if (Math.abs(value() - f.value()) &lt; 0.00001) {
                return 0;
            }
            if (value() &gt; f.value()) {
                return 1;
            }
            return -1;
        }
  
  }
  
  </code></pre>
  
  <pre><code>public class MyDate implements Comparable&lt;MyDate&gt; {
    private int year, month, day;
  
  public MyDate(int z, int y, int x) {
        if (z&lt;1000 || z&gt;3000) {
            z = 2000;
        }
        if (y&lt;1 || y&gt;12) {
            y = 1;
        }
        if (x&lt;1 || x&gt;31) {
            x = 1;
        }
  
        day = x;
        month = y;
        year = z;
    }
  
    public String toString() {
          return day + "/" + month + "/" + year;
      }
  
    @Override
    public int compareTo (MyDate date){
  //    MyDate date = (MyDate) obj;
        int diffYear = year - date.year;
        if (diffYear &lt; 0) {
            return -1;
        }
        else if (diffYear &gt; 0) {
            return 1;
        }
  
        int diffMonth = month - date.month;
        if (diffMonth &lt; 0) {
            return -1;
        }
        else if (diffMonth &gt; 0) {
            return 1;
        }
  
        int diffDay = day - date.day;
        if (diffDay &lt; 0) {
            return -1;
        }
        else if (diffDay &gt; 0) {
            return 1;
        }
  
        return 0;
    }
  }
  </code></pre>