title: Sorting an array of comparable interface
body: <p>I have written sorting methods for an array of comparables, insertion, merge, and selection, I've done this by altering code I had before from sorting an int array, and I just changed things from int to Comparable. However, When I was doing it for int arrays, I knew very well how to actually use the method, for example this is my my selection sort for ints: </p>
  
  <pre><code> public void selectionSort(int[] list){
      for (int i=0;i&lt;list.length;i++){
          for (int si=i;si&lt;list.length;si++){
              if (list[si]&lt;list[i]){
                  int temp=list[i];
                  list[i]=list[si];
                  list[si]=temp;
              }
          }
      }        
  }
  </code></pre>
  
  <p>and this is the code which ends up using this method:</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner in=new Scanner(System.in);
      int numItems,searchNum,location;
      Sorts sort=new Sorts();        
      int[]test;        
      System.out.print("Enter the number of elements: ");
      numItems=in.nextInt();
      test=new int[numItems];
  
      for (int i=0;i&lt;test.length;i++){
          test[i]=(int)(100*Math.random());
      }
  
      System.out.println("Unsorted: ");
      displayArray(test);
      sort.selectionSort(test);
      System.out.println("Sorted: ");        
      displayArray(test);    
  </code></pre>
  
  <p>and everything works fine, but for my comparable selection sort, I have this code:</p>
  
  <pre><code>public static void selectionSort(Comparable[] list){   
  for (int i=0;i&lt;list.length;i++){
          for (int si=i;si&lt;list.length;si++){
              if (list[si].compareTo(list[i])&lt;0){
                  Comparable temp=list[i];
                  list[i]=list[si];
                  list[si]=temp;
              }
          }
         }
      }
  </code></pre>
  
  <p>but when I get to writing the code to test out this method, I just have no idea how to approach it, I don't know how I can make an array of Comparable interfaces, the concept is just so confusing for me and I can't find a way to make it work.</p>