Java - Threads using a loop : Having trouble printing the contents of my array in a non synchronized way. I am looking to iterate through and output the letters "A" , "B" , "C" in a non sequential manner from a static array of strings using Threads to print the loop. 

Here is my Code



public class ThreadWithExtends extends Thread {

	public ThreadWithExtends() {
		super();
	}

	public void run() {
		String[] arr = { "A", "B", "C" };
		int num = 10;
		try {
			for (int j = 0; j < num; j++) {
				for (int i = 0; i < arr.length; i++) {
					sleep((int) (Math.random() * 1000));
					System.out.print(arr[i] + " ");
				}
			}

		} catch (InterruptedException e) {
			System.out.println("Finished");
		}
	}
}

My TestThread class


public class TestThread {
	
	public static void main(String args[]) {
		new ThreadWithExtends().start();
	}

}

My Output : A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C 


My Desired Output : C A B A B C B A C .. etc , not sequential like above. 

