creatthreadimplement.java

来自「一些常用的java程序,包括swing.net.io,matrix等」· Java 代码 · 共 32 行

JAVA
32
字号
package creaatThread;

//new Thread(new CreatThreadImplement(i)).start();

public class CreatThreadImplement implements Runnable
{
	private int t_id;
	private int testnum;// = id;
	public CreatThreadImplement(int id)
	{
		t_id = id;
		System.out.println("CreatThreadImplement Creat Thread id :" +id);
	}//CreatThread(int)
	
	public void run()
	{
		for(int i = 0; i < 5; i++)
		{
			System.out.println(t_id + " : testnum == "+testnum);
			testnum = i;
			//try{Thread.sleep(1000);}catch(Exception e){}
		}//for
	}//run
	
	public static void main(String [] args)
	{
		for(int i = 0; i < 3; i++)
			new Thread(new CreatThreadImplement(i)).start();
	}//main()

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?