title: Java: Can I create Generic-typed static classes?
body: <p>I'm working on a Quicksort algorithm in java, and I'm required to use arrays.</p>
  
  <p>Right now, I want to make this algorithm support sorting any array of Comparables.  </p>
  
  <p>I've looked around, but most of the discussion and tutorials around generics are pretty confusing.  Simply put, I'm not sure how to make this work.  I've already confirmed that the Quicksort works with Integers, Strings, etc, so all I need to do is make it work with all comparables.  But my IDE is telling me that I "cannot make a reference to the non-static type T".  I'm not sure what this really means.</p>
  
  <pre><code>public class QuickSort&lt;T extends Comparable&lt;T&gt;&gt; {
  
  public static void Sort(T[] A) {
      QuickSortRecursive(A, 0, A.length-1);
  }
  
  public static  void QuickSortRecursive(T[] A, int p, int r) {
  
      if( p &lt; r ) {
          int q = Partition(A, p, r);
          QuickSortRecursive(A, p, q-1);
          QuickSortRecursive(A, q+1, r);
      }
  }
  
  public static int Partition(T[] A, int p, int r) {
      String x = A[r];
  
      int i = p - 1;
      for(int j = p; j &lt; r; j++) {
          if(A[j].compareTo(x) &lt;= 0) {
              i = i + 1;
              //swap A[i] with A[j]
              T tmp = A[i];
              A[i] = A[j];
              A[j] = tmp;
          }
      }
      //swap A[i + 1] with A[r]
      T tmp2 = A[i + 1];
      A[i + 1] = A[r];
      A[r] = tmp2;
      return i + 1;
  }
  
  }
  </code></pre>
  
  <p>In a nutshell, what am I doing wrong here?</p>