public class ThreadTest extends Thread {
	static int millionsecond=500;
	public void run(){
		while(true){
			try{
				Thread.sleep(millionsecond);//单位：毫秒
			}catch(InterruptedException e){
				e.printStackTrace();
			}
			System.out.println(Thread.currentThread().getName());
		}
	}

	public static void main(String[] args){
		ThreadTest t1 = new ThreadTest();
		t1.start(); //启动了一个线程
		ThreadTest t2 = new ThreadTest();
		t2.start(); //又启动了一个新的线程
		
		while(true){
			try{
				Thread.sleep(millionsecond);//单位：毫秒
			}catch(InterruptedException e){
				e.printStackTrace();
			}
			System.out.println("hello, main");
		}
	}
}
