ITeye博客

多线程学习 一 多线程的使用

nickdine · 2010-08-30 15:14 · 编程语言 · thread · 多线程 · Markdown

package i.tommy.test.Test;

import i.tommy.test.action.indexAction;

public class mutiThread
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Thread t=new Thread(new Runner());
		t.start();
		for(int i=0;i<100;i++)
		{
		   System.out.println("main:#"+i);	
		}
		Thread tt=new RunnerB();
		tt.start();
		
	}
}

class Runner implements Runnable
{
	public void run()
	{
		for(int i=0;i<100;i++)
		{
			System.out.println("runner:#"+i);
		}
	}
}
class RunnerB extends Thread
{
	public void run()
	{
		for(int i=0;i<100;i++)
		{
			System.out.println("runnerB:#"+i);
		}
	}
}


两种多线程的实现方法

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。