My objective is to create a working insertion sort that can handle strings and integers using the array given to us in the main method. For this example I called it list.
public class insort{
public static void main(String[]list){
sort(list);
printsort(list);
}//main
public static void sort(String[]list){
for (int index = 1; index < list.length; index++){
int key = list[index];
int position = index;
while (position > 0 && key.compareTo(list[position-1]) < 0){
list[position] = list[position-1];
position--;
}//while
list[position] = key;
}//for
}//sort
public static void printsort(String[]list){
while ( i < list.length){
System.out.print(i);
}//while
}//printsort
}//insort
int key = list[index];// This will return a String. Not an int. Compiler will show the error.