I am trying to sort a certain amount of integers. I have an error in my code. The code is below as well as my error message. Any suggestions of how to fix this? I believe it has to do with it being primitive data rather than an object?

`public static void main(String[] args) {

    int[] intList;
    int size;

    Scanner scan = new Scanner(System.in);

    System.out.print("\nHow many integers do you want to sort? ");
    size = scan.nextInt();
    intList = new int[size];

    System.out.println("\nEnter the numbers...");
    for (int i = 0; i < size; i++)
        intList[i] = scan.nextInt();
    Sorting.insertionSort(intList);

    System.out.println("\nYour numbers in sorted order...");
    for (int i = 0; i < size; i++)
        System.out.print(intList[i] + " ");
    System.out.println();
    `
    and the error code is this.....


xception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Sorting.insertionSort
at Numbers.main(Numbers.java:29)
Java Result: 1
BUILD SUCCESSFUL (total time: 51 seconds)'

How does the Sorting.insertionSort() method look like? Is it from any standard API?

Edited 4 Years Ago by NP-complete

Obviously you can't run the program if it didn't compile!
When you compiled the program it found an error and will have given you a detailed error mesage explaining what was wrong. What did that say?

As you have mentioned that

Sorting.insertionSort(intList)

where you have declared Sorting object,and you are calling insertionsort method with passing inList array argument..?

Show where you have make this method...

Your program shows at line 15-->

Sorting.insertionSort(intList); 

Can you please provide the details of this method "insertionSort" of class Sorting.
it is obvious from the error message that class "Sorting" is not there and hence current program could not be compiled.
Please write the a class "Sorting" with a static method "insertionSort(int[] numberList)".
Then try running the this code again.

Edited 4 Years Ago by subramanya.vl

This question has already been answered. Start a new discussion instead.