No2.新建线程

public class CreatThread01 implements Runnable{

	public static void main(String[] args) {
		
		Thread t1 = new Thread(new CreatThread01());
		t1.start();
		//注意不要使用run()来开启新线程,它只会在当前线程中,串行执行,run()中的代码
//		t1.run();
		
	}
	
	@Override
	public void run() {
		System.out.println("hi, I am CreatThead01");
	}

}

猜你喜欢

转载自blog.csdn.net/shasiqq/article/details/53812361