title: Error: Java:31 cannot find symbol
body: <p>So I get this error while trying to compile my java program</p>
  
  <pre><code>./QuickSort.java:31: cannot find Symbol
  Symbol : method compareTo(T)
  location: class java.lang.Object
        while(x&lt;high &amp;&amp; (arrValues[x].compareTo(arrValue))==1){
                                     ^
  </code></pre>
  
  <p>It says the same for line 35.</p>
  
  <p>I created a generic Class QuickSort and in this case the T value is Person. Line 31 and 35 are in the function <code>divide</code></p>
  
  <pre><code>class QuickSort&lt;T&gt; extends AbstractSorter { 
  private T[] values;
  private int dataCount;
  
  QuickSort(){
      System.out.println("INITILAZIED");
  }
  
  public void switchValues(T[] arrValues, int index1, int index2){
      T temporary = arrValues[index1];
      arrValues[index1] = arrValues[index2];
      arrValues[index2] = temporary;
  }
  
  
  public void actualSort(T[] arrValues, int low, int high){
      if(low&lt;high){
          int newHigh = divide(arrValues,low,high);
          actualSort(arrValues,low,newHigh);
          actualSort(arrValues,low+1,high);
      }
  }
  
  public int divide(T[] arrValues, int low, int high){
      T arrValue = arrValues[low];
      int x = low - 1;
      int y = high +1;
  
      while(true){
          ++x;
          while(x&lt;high &amp;&amp; (arrValues[x].compareTo(arrValue))== 1){
              ++x;
          }
          --y;
          while(y&gt;low &amp;&amp; (arrValues[y].compareTo(arrValue)) == -1){
              --y;
          }
          if(x&lt;y){
              switchValues(arrValues,x,y);
          }
          else
              return y;
      }
  }       
  
  public void doSort(){ 
      this.actualSort(values, 0, values.length-1);
  }
  
  public void sortArray(int orderOfSort, T[] arrayOfValues){
      this.values = arrayOfValues;
      this.doSort();
      System.out.println("IT WORKED");
  }   
  </code></pre>
  
  <p>And I have the compareTo Method for Person here. </p>
  
  <pre><code>    public int compareTo(Person a){ //1 signifies THIS is alphabetically first, 0 signifies equal, -1 signifies Person a is first
      if(this.lastName.compareTo(a.lastName) == 1){
          return 1;
      }
      else if(this.lastName.compareTo(a.lastName) == 0){
          if(this.firstName.compareTo(a.firstName) == 1){
              return 1;
          }
          else if(this.firstName.compareTo(a.firstName) == 0){
              return 0;
          }
          else{
              return -1;
          }
      }
      else{
          return -1;
      }
  
  }
  </code></pre>
  
  <p>Im not sure whats causing this error.
  Your help will be greatly appreciated!!</p>