[Solved] NullPointerException error in Insertion sort [closed]
You are not passing the array object to sort method. Try the following code: public class SortTest { public void sort(String[] array) { String insert; for (int next = 1; next < array.length; next++) { insert = array[next]; int moveItem = next; while (moveItem > 0 && array[moveItem – 1].compareTo(insert) > 0) { array[moveItem] = … Read more