threadtest.java

来自「200多个自己编的java程序,大家可以学一下.」· Java 代码 · 共 38 行

JAVA
38
字号

// the usual class does not need public
class CountingThread extends Thread{
	
	public void run()
	{
		System.out.println("The Thread start:"+this);
		for(int i=0;i<9;i++)
		System.out.print("i="+(i+1)+"\t");
		//if println
		//is has enter huan hang de yi si
		System.out.println("");
		System.out.println("thread stopped :"+this);
		
	}
}
public class ThreadTest{
	/**
	 * Method main
	 *
	 *
	 * @param args
	 *
	 */
	public static void main(String[] args) {
		// TODO: Add your code here
		
		System.out.println("Starting ThreadTest...");
		CountingThread t1=new CountingThread();
		t1.start();
		CountingThread t2=new CountingThread();
		t2.start();
		CountingThread t3=new CountingThread();
		t3.start();
		System.out.println("the test is Done");
	}
	
}

⌨️ 快捷键说明

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