实现Java多线程,采用Thread的方法:Start()方法只能调用一次,如果调用2次或者2次以上否则有异常!
class Mythread extands Thread
{
private String threadid;
public Mythread(String threadid)
{
this.threadid = threadid;
}
public void run()
{
for(int i=0; i<10;i++)
{
System.out.println(threadid+"运行线程 i = "+i);
}
}
}
public class ThreadDeom
{
public static void main(String agrs[])
{
Mythread mt = new Mythread("线程A");
mt.start();
}
}