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();

    System.out.println("\nYour numbers in sorted order...");
    for (int i = 0; i < size; i++)
        System.out.print(intList[i] + " ");
    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)'

Recommended Answers

All 4 Replies

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

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


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-->


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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.