I am working on a sorting algorithm class and a main class to test the Sorting Algorithms. Whenever I try to call a method from the sorting algorithm class in the main class, I get an error similar to this one:
The method quickSortRandom(T[], int) in the type SortAlgorithms is not applicable for the arguments (int[], int)
I am attempting to input an array of integers into a method that accepts Type T[], and I do not understand why that doesn't work or how to fix it. Here is the main method:
public static void main(String args[]) {
int arr[] = {10, 7, 8, 9, 1, 5};
int n = arr.length;
SortAlgorithms s = new SortAlgorithms();
s.quickSortRandom(arr,arr.length); }
And here is the quickSortRandom method in the sorting algorithms class:
public static <T extends Comparable<? super T>>
void quickSortRandom(T[] array, int n)
{
quickSortRandom(array, 0, n-1);
} // end quickSortRandom