public class Threads extends Thread { public Threads() {
super();
// TODO 自动生成构造函数存根
}

public void run(){
for(int i=0;i<50;i++){
System.out.println(this.currentThread().getName()+i);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
if(i==5){
try {
if(currentThread().getName().equals("线程A:")){

currentThread().join();
}
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
if(i==49){

}
}
//dumpStack();
}

public static void main(String arg[]){

Threads thread1 = new Threads();
thread1.setName("线程A:");
Threads thread2 = new Threads();
thread2.setName("线程B:");
Thread.currentThread().yield();
thread1.start();
thread2.start();
System.out.println("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
//System.out.println(Thread.activeCount());

}}
这是我的例子,我运行的时候起动二个线程:线程A和线程B,当i=5的时候,我把线程A进行等待状态,我想线程B运行完以后,再把线程A起动,不知道怎么搞了,请搞手帮忙啊!先谢谢了.