thread1=new Thread(this,"FirstThread");//新建立一会线程 取名字为FirstThread  String currentRunning; // 声明一个字符串类型变量
  while(true)
  {
  currentRunning=Thread.currentThread().getName();//currentThread()方法是得到当前运行的线程的名字
  if(currentRunning.equals("FirstThread"))//进行判断如果当前运行的是线程1 则 count1加1
    {
        count1++;
        threadFirst.setText("线程1第"+count1+"次被调用"); //在threadFirst控件上输出 线程1第?次被调用
    }
    else if(currentRunning.equals("SecondThread")) //行判断如果当前运行的是线程1 则 count2 加1
    {
        count2++;
        threadSecond.setText("线程2第"+count2+"次被调用"); 
    }