0

I can't get the following line of code to work it also tells me this, but I don't know what to do with the information

quickSort(c, 0, c.length - 1); 

This is the method

static <T extends Comparable<? super T>> void quickSort(T[] a, int p, int r){
            if (p < r){
            int q = partition(a,p,r);
            quickSort(a,p,q-1);
            quickSort(a,q+1,r);

but the line

quickSort(a, 0, a.length - 1);

works fine

side note: the "c" is supposed to represent a circle object which I have a class made for I think that this has to do with maybe the code in the class but I am really lost on what to put in it, this is what I have

class Circle<T>
{
    T obj;
    Circle(T obj) {  this.obj = obj;  }  // constructor
    public T getObject()  { 
        return this.obj; }
}

I don't know what else to add to this post if you have any questions or would like me to clarify anything else please let me know

This is a picture of the whole program minus the class which I inserted above

Kevin
  • 9
  • 2
  • That quicksort() method works on T's that implement Comparable. Your Circle class needs to implement Comparable. See the question [How to implement the Java comparable interface](https://stackoverflow.com/questions/21626439/how-to-implement-the-java-comparable-interface). – Andy Thomas Nov 15 '21 at 15:37
  • You tried to invoke a method that expects an array as the first parameter with a single object `c` that is a `Circle`. – Hulk Nov 15 '21 at 15:37

0 Answers0