Hello, I am new to java i am writting a small java program using threads to sort values in a array of integers. So far I have my array of integers but im having trouble writting the threads that do the actual sorting. Can anyone offer please offer me help with this it would be much appreciated.

Can you provide some more detail where you have been struck up.
If you don't know how to start with creating thread then you can get a nice tutorial here

Thank u all for your quick reply, Here is the coding I have so far. As i said before i dnt know how to start coding the threads. (The "................................" means that coding to do with the threads that sort the array of integers should be. But that is where im stuck on as I at the moment dont know how to code or create the threads.

import java.util.Random;
import java.util.Scanner;


public class SorterThread {

 static final int NUM_THREADS =  20; 
    static final int MAX_ELEMENTS = 100;
    static int[] array = new int[MAX_ELEMENTS]; 
    static Scanner scanner = new Scanner(System.in); 
    static int numElements; 

public static void main(String[] args) {
        int number;
        SorterThread threads = new SorterThread[NUM_THREADS]; 

        do {
            // user input
            System.out.print("Please enter an integer value (to end enter 0): ");
            number = scanner.nextInt();
            // check if user wants to end
            if (number != 0) { 
                array[numElements]=number;
                numElements++;
            }System.out.println("");
        } while (number != 0); 

.....................................................

.....................................................


// run the thread
    public void run() {
        boolean changed;

....................................................

....................................................

....................................................


static void showArray() {
        for (int i=0;i<numElements;i++) {
            if (i!=0) {
                System.out.print(",");
            }
            System.out.print(array[i]);

        }
        System.out.println("");
    } 
}

So read the tutorials that were posted and try it. The burden is upon you to make an honest try before asking 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.