Java-多线程的实现与启动

class mythread extends Thread  //多线程的启动
{
 private String name;
 public mythread(String name)
 {
  this.name=name;
 }
 public void run()
 {
  for(int i=0;i<10;i++)
  {
   System.out.println("线程"+name+"运行结果:"+i);
  }
 }
}
public class test58 {
 public static void main(String args[])
 {
  mythread a=new mythread("A");
  mythread b=new mythread("B");
  a.start();
  b.start();
 }
}

posted @ 2013-07-20 19:19  javawebsoa  Views(201)  Comments(0Edit  收藏  举报