JAVA版的Sleep Sort

/*
 * @(#)SleepSort.java 0.1 2011-6-21
 * Copyright 2006 DiaoxianSoft Development Team. All rights reserved.
 * DiaoxianSoft PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
/** 
 * 临时写就的JAVA版的sleep sort
 * Copyright:   Copyright (c)
 * Company:     DiaoxianSoft development team
 * @author Geek_Soledad 
 * @creation date 2011-6-21 下午01:48:28 
 * @version 0.1
 */

public class SleepSort implements Runnable{
	static int[] array = {3,5,2,4,6,8};
	private int i;
	
	public SleepSort(int i) {
		this.i = i;
	}
	
	public static void main(String[] args) {
		for (int i = 0; i < array.length; i++) {
			new Thread(new SleepSort(i)).start();
		}
	}

	public void run() {
		try {
			Thread.sleep(array[i]*100);
			System.out.print(array[i] + ", ");
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}

你可能感兴趣的:(java,thread,c,Date,String,Class)